Lib for getting schedule data from Yandex.Rasp API
Project description
yaschedule
Lib for getting schedule data from Yandex.Rasp API: https://yandex.ru/dev/rasp/doc
Quick Start
Init
from yaschedule.core import YaSchedule
# TO GET TOKEN - https://yandex.ru/dev/rasp/doc/concepts/access.html
TOKEN = 'some string'
yaschedule = YaSchedule(TOKEN)
[optional] requests caching
See more at requests_cache docs
print(yaschedule.session.settings.expire_after) # get particular cache setting
yaschedule.session.settings.expire_after = 600 # set particular cache setting
print(yaschedule.session.settings) # get all cache settings as object of <class 'requests_cache.policy.settings.CacheSettings'>
print({ a : getattr(yaschedule.session.settings, a) for a in dir(yaschedule.session.settings) if not a.startswith('_') }) # get all cache settings as dict
Usage
# get all stations in json
yaschedule.get_all_stations() # !!! The size of the returned data is about 40 MB
# cities and stations codes from yaschedule.get_all_stations()
city_1 = 'c213' # Moscow
city_2 = 'c2' # Saint-Petersburg
station_1 = 's9600366' # Pulkovo
station_2 = 's9600213' # Sheremetevo
# get station schedule
yaschedule.get_station_schedule(station=station_1)
# get schedule between two stations
yaschedule.get_schedule(from_station=station_1, to_station=station_2)
# get schedule between two cities
yaschedule.get_schedule(from_station=city_1, to_station=city_2)
# get schedule between city and station
yaschedule.get_schedule(from_station=city_1, to_station=station_1)
# u can also specify other request params of request
# transport_type by default get all transport types
yaschedule.get_schedule(from_station=city_1, to_station=city_2, transport_types='train')
yaschedule.get_schedule(from_station=city_1, to_station=city_2, transport_types='plane')
# transfers by default: False
yaschedule.get_schedule(from_station=city_1, to_station=city_2, transfers=True)
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
yaschedule-0.0.4.2.tar.gz
(7.2 kB
view details)
File details
Details for the file yaschedule-0.0.4.2.tar.gz
.
File metadata
- Download URL: yaschedule-0.0.4.2.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 114be5f56b270c4b0a9491860325d95cc104c71f073a301cc4276276224a952f |
|
MD5 | 04fb4f9da427cf4016144d7b2c3e0c56 |
|
BLAKE2b-256 | 23fd15bdd007716d535f1faa5107121321639848e26b107c5a9f2319f6247546 |