Skip to main content

A simple Python package to build event based requests for the NewsEye API

Project description


This Python package is used to represent a wikivents Event object as a Solr or 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"))

# 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")

Project details

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

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page