News

Remember instance an object of FouryouseeAPI, according to the basic set up

Getting the news

fouryousee.FouryouseeAPI.get_news(self, **kwargs)

Get the medias of the 4YouSee account.

Parameters
  • id (int, optional) – Id of the specific new.

  • newsourceId (int, optional) – Id of the Newsource.

  • startDate (str, optional) – Start date of the news.

  • endDate (str, optional) – End date of the news.

  • status (str, optional) – Status of the news. The possible values are approved, disapproved or, waiting.

Returns

List of dicts, where dict depicts a news.

Return type

list

Usage

Once “my” object has been created. You can execute the next:

Getting all the news. It will return all the news of your news. It will be a list of dicts. If there is no news will return a empty list.

Note

Depend of the quantity of news, this execution use to take more than 7 seconds.

>>> my.get_news()

If there is no news

>>> my.get_news()
[]

If you know the news id

>>> my.get_news(id=401579)
{
   "file":"https://4usee.com/****-*****/****/common/imgnews/0.png",
   "approvalDate":"2020-02-19 07:35:28",
   "content":{ "texto":"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt" },
   "creationDate":"2020-02-19 07:35:28",
   "startDate":"2020-02-19 00:33:00",
   "endDate":"2033-02-20 07:33:00",
   "status":"approved",
   "image":"0.png",
   "id":401579,
   "newsourceId":116,
   "newsourceName":"Barra Noticias Manual",
   "hash":"None"
}

If the id doesn’t exists.

>>> my.get_news(id=123_456)
Exception: {"error":"C004","message":"Resource not found."}

Filtering by newsourceId (Feed Rss), status, startDate and endDate

>>> my.get_news(newsourceId=55)  # If the newsourceId doesn't exist
[]
>>> my.get_news(newsourceId=125, status='approved',
...             startDate='2022-07-01', endDate='2022-07-02 13:02:00')
[
   {
      "id":501609,
      "content":{
         "img":"https://cnnespanol.cnn.com/wp-content/uploads/
         2022/03/GettyImages-1210678056.jpg?quality",
         "amp;strip":"info",
         "tag_description":"A partir de marzo de 2022, los pagos del Ingreso
          solidario son bimensuales y desde julio, los montos cambiarán
          según la clasificación del Sisbén IV.",
         "tag_title":"Calendario Ingreso Solidario 2022: cuáles son los
          fechas de los siguientes pagos en Colombia"
      },
      "creationDate":"2022-07-01 13:01:25",
      "status":"approved",
      "approvalDate":"2022-07-01 13:01:25",
      "startDate":"2022-07-01 13:01:25",
      "endDate":"2022-07-02 13:01:25",
      "newsourceId":47,
      "newsourceName":"CNN",
      "image":"https://4usee.com/.../501609.jpeg"
   }
]

Adding news

Warning

It hasn’t been built the function that create news.

Editing news

Warning

It hasn’t been built the function that edit news.

Deleting news

Warning

It hasn’t been built the function that delete news.