Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for newseyevent, version 0.1.0.dev202101111736
Filename, size File type Python version Upload date Hashes
Filename, size newseyevent-0.1.0.dev202101111736.linux-x86_64.tar.gz (9.4 kB) File type Source Python version None Upload date Hashes View
Filename, size newseyevent-0.1.0.dev202101111736-py3-none-any.whl (18.4 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page