Python library for easier use of www.trafiklab.se api's'
Project description
sthlmkollektivtrafik
Download
pip install sthlmkollektivtrafik
Environment variable names
Store your api's as an environment variables with the names:
Plattsuppslag: SKT_location_api
Realtidsinformation: SKT_realtime_api
Storningsinformation: SKT_delay_api
Reseplanerare: SKT_planner_api
Platsuppslag
Examples
from sthlmkollektivtrafik import platsuppslag
result = platsuppslag.search("searchString")
print("Name: {} Id: {}".format(result.name, result.id))
Parameters
Name | Type | Description |
---|---|---|
.name | String | name of the place |
.id | Integer | station id |
.type | String | station, adrees or POI |
.all | json file | everything |
.code | Integer | statuscode from call |
.responses | Integer | number of results |
.stations | String-list | all search-results, names |
.log | String-list | log |
Realtidsinformation
Example
from sthlmkollektivtrafik import realtidsinformation
result = realtidsinformation.departure("stationId", "timewindow")
for i in range(len(result.busDest)):
print("{} {} - {}".format(result.busDest[i], result.busNum[i], result busTime[i]))
Parameters
Name | Type | Description |
---|---|---|
.all | json file | everything |
.buses | json file | all bus departures |
.metros | json file | all metro departures |
.trains | json file | all train departures |
.(bus/metro/train)Dest | String-list | ex .busDest |
.(bus/metro/train)Time | String-list | ex .metroTime |
.(bus/metro/train)Num | String-list | ex .trainNum |
.log | String-list | log |
Storningsinformation
Example
from sthlmkollektivtrafik import storningsinformation
result = realtidsinformation.departure("stationId")
print(result.headers[0])
print(result.details[0])
Parameters
Name | Type | Description |
---|---|---|
.all | json file | everything |
.headers | String-list | titles |
.details | String-list | text |
.log | String-list | log |
Reseplanerare
Example
from sthlmkollektivtrafik import reseplanerare
result = reseplanerare.searchJourney("startId", "destId")
for leg in res.journey[0]:
print("{} {}: Take {} to {} ".format(leg[1], leg[0], leg[2], leg[4]))
Parameters
journey = [journey1, journey2, journey3...]
journey1 = [leg1, leg2, leg3....]
leg = [startTime, startName, transportName, destTime, destName]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file sthlmkollektivtrafik-0.1.5.tar.gz
.
File metadata
- Download URL: sthlmkollektivtrafik-0.1.5.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 985007bf1a7008c0945b25f263906dfe9496cffa7e293a3137ab1573e7cd29f3 |
|
MD5 | 8f81a4ab3921b10e0b7aa14435705b0e |
|
BLAKE2b-256 | d5cd5b27c8566595f65cb9844187e6e8158b76e4332a1fa995dd6c6dd9783988 |