Python package to interact with Factiva news-related APIs. Services are described in the Dow Jones Developer Platform.
Project description
This library simplifies the integration to Factiva API services for news-related services.
The following services are currently implemented.
Snapshots: Allows to run each snapshot creation, monitoring, download and local exploration, in an individual manner. Also allows to run the whole process within a single method.
Streams: In addition to creating and getting stream details, contains the methods to easily implement a stream listener and push the content to other locations appropriate for high-available setups.
The previous components rely on the API-Key authentication method, which is a prerequisite when using either of those services.
Installation
To install this library, run the following commands.
$ pip install --upgrade factiva-news
Using Library services
Create a new snapshot and download to a local repository just require a few lines of code.
from factiva.news.snapshot import Snapshot
my_query = "publication_datetime >= '2020-01-01 00:00:00' AND LOWER(language_code) = 'en'"
my_snapshot = Snapshot(api_user='abcd1234abcd1234abcd1234abcd1234', query=my_query)
news_articles = my_snapshot.process_extract() # This operation can take several minutes to complete
In the previous code a new snapshot is created using my_query as selection criteria and api_key for user authentication. After the job is being validated internally, a Snapshot Id is obtained along with the list of files to download. Files are automatically downloaded to a folder named equal to the snapshot ID, and contents are loaded as a Pandas DataFrame to the variable news_articles. This process may take several minutes, but automates the extraction process significantly.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for factiva_news-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f241e0c98c332cdb587c4407f2fec1f225397fe722697da7f5a2f64e5301bce |
|
MD5 | ebb8f382181d6d65d80ab65a667e4c77 |
|
BLAKE2b-256 | a58bb371b285c6f11268804d7c9c63937e81b0d5ae9ed8c4aeccdc883efc57ea |