Event Scraper
Don't stable, work in progress.
Istalling:
pip install git+https://git@github.com/ArtemErmulin/escraper.git@master#egg=escraper-1.1.1
Available sites-parsers:
>>> from escraper.paresrs import all_parsers
>>> all_parsers
{'timepad': escraper.parsers.timepad.Timepad,
'radario': escraper.parsers.radario.Radario}
>>> from escraper import Timepad
For using timepad parser, you need timepad token. There are several ways to apply you token:
- as argument
token
inTimepad
class
>>> timepad = Timepad(token=<your-token>)
- as environ variable
TIMEPAD_TOKEN
. Then don't need any argument inTimepad
class
>>> import os
>>> "TIMEPAD_TOKEN" in os.environ
True
>>> timepad = Timepad()
Get event post by event_id:
>>> timepad.get_event(event_id=1234567)
<event namedtuple>
or by url:
>>> event_url = "https://timepad.ru/event/1234567/"
>>> timepad.get_event(event_url=event_url)
<event namedtuple>
Get events by parameters (for more see Timepad.get_events
docstring):
>>> timepad.get_events(request_params=params)
<list events data namedtuple>
>>> from escraper import Radario
For using radario parser you don't need any tokens:
>>> radario = Radario()
Get event from radario will raise NotImplementedError
.
Get events by parameters (for more see Radario.get_events
docstring):
>>> radario.get_events(request_params=params)
<list events data namedtuple>