A simple Python package to build event based requests for the NewsEye API
Project description
newseyevent
This Python package is used to represent a wikivents
Event
object as a Solr or platform.newseye.eu query string. Full documentation is hosted on Gitlab Pages and available publicly.
Request managers
The only object you should use in order to export event is either the SolrCollection
and the SolrQueryEventArticlesInLanguage
class or inherited classes.
Below is an example on how to use the SolrRequestManager
:
from wikivents.models import ISO6391LanguageCode
from wikivents.factories.wikimedia import WikimediaFactory
from datetime import datetime
from newseyevent.solr import SolrQueryEventArticlesInLanguage, SolrQueryEventArticlesInLanguageDateRange, \
SolrInstance, SolrCollection
# Create the Easter Rising event instance
event = WikimediaFactory.create_event("Q193689")
# Create the object representing the Solr Collection (on a specific host, with an explicit collection name)
solr_collection = SolrCollection(SolrInstance("localhost", 8993), "newseye_collection")
# Query articles related to the event, in English
query_articles_in_lang = SolrQueryEventArticlesInLanguage(event, ISO6391LanguageCode("fr"))
print(solr_collection.query(query_articles_in_lang))
# Query articles related to the event, in English, published between 01/01/1910 and 01/01/1911
query_articles_in_lang_date_range = SolrQueryEventArticlesInLanguageDateRange(
event, ISO6391LanguageCode("en"),
datetime.strptime("1910-01-01", "%Y-%m-%d"),
datetime.strptime("1911-01-01", "%Y-%m-%d")
)
print(solr_collection.query(query_articles_in_lang_date_range))
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
File details
Details for the file newseyevent-0.1.0.dev202101111736.linux-x86_64.tar.gz
.
File metadata
- Download URL: newseyevent-0.1.0.dev202101111736.linux-x86_64.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0a7410b7ce6e49c3c8a22dbf2c1974337f1c9492a8ef47adc51aa3f6ac0d114 |
|
MD5 | ab07fca0dc181e24d43f962e029acda5 |
|
BLAKE2b-256 | 82f5b27971f10e8960078c97a46f6b0bff04a5e88eb7e2a13f1d5d09a65cbd69 |
File details
Details for the file newseyevent-0.1.0.dev202101111736-py3-none-any.whl
.
File metadata
- Download URL: newseyevent-0.1.0.dev202101111736-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a39af1a9ec6378843247a005b011f6882538b1d950b673544d11e73a786d22df |
|
MD5 | b53f701cc37ca6a7c54e24e8fba98f2e |
|
BLAKE2b-256 | 8cb8a44fee9c2669163dd81a801ee3aa856ab604525818a0c485b607326cf88f |