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
event = WikimediaFactory.create_event("Q193689")
solr_collection = SolrCollection(SolrInstance("localhost", 8993), "newseye_collection")
query_articles_in_lang = SolrQueryEventArticlesInLanguage(event, ISO6391LanguageCode("fr"))
print(solr_collection.query(query_articles_in_lang))
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))