You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library simplifies the integration to Factiva Analytics API services that delivers premium news content.
6
7
@@ -10,6 +11,7 @@ The following services are currently implemented.
10
11
* **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.
11
12
* **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.
12
13
* **Taxonomy**: Operations that return taxonomies applied to classify news content.
14
+
* **ArticleFetcher**: Gets article's content by unique identifiers (AN), for display purposes only.
13
15
14
16
Installation
15
17
============
@@ -23,68 +25,95 @@ Using Library services
23
25
======================
24
26
Most Factiva Analytics services are implemented in this library. There may be a delay (commonly weeks) when new features are released and their operations are implemented in this package.
25
27
26
-
Creating a User Instance and Getting its statistics
Create a new snapshot and download to a local repository just require a few lines of code.
62
105
63
106
.. code-block:: python
64
107
65
-
from factiva.analytics importSnapshot
66
-
my_query ="publication_datetime >= '2020-01-01 00:00:00' AND LOWER(language_code) = 'en'"
67
-
my_snapshot =Snapshot(
108
+
from factiva.analytics importSnapshotExtraction
109
+
my_query ="publication_datetime >= '2023-01-01 00:00:00' AND UPPER(source_code) = 'DJDN'"
110
+
my_snapshot =SnapshotExtraction(
68
111
user_key='abcd1234abcd1234abcd1234abcd1234', # Can be ommited if exist as env variable
69
112
query=my_query)
70
-
my_snapshot.process_extract() # This operation can take several minutes to complete
113
+
my_snapshot.process_job() # This operation can take several minutes to complete
71
114
72
115
After the process completes, the output files are stored in a subfolder named as the Extraction Job ID.
73
116
74
117
In the previous code a new snapshot is created using my_query as selection criteria and user_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.
75
118
76
-
Streams
77
-
-------
78
-
Create a stream instance and get the details to configure the stream client and listen the content as it is delivered.
79
-
80
-
.. code-block:: python
81
-
82
-
from factiva.analytics import Stream
83
119
84
-
stream_query = Stream(
85
-
user_key='abcd1234abcd1234abcd1234abcd1234', # Can be ommited if exist as env variable
86
-
user_key_stats=True,
87
-
query="publication_datetime >= '2021-04-01 00:00:00' AND LOWER(language_code)='en' AND UPPER(source_code) = 'DJDN'",
0 commit comments