|
2017-09-24
, 16:54
|
Posts: 68 |
Thanked: 147 times |
Joined on Dec 2016
|
#2
|
The Following User Says Thank You to bomo For This Useful Post: | ||
|
2017-09-24
, 19:08
|
|
Posts: 141 |
Thanked: 1,530 times |
Joined on May 2011
@ Finland
|
#3
|
Edit2: I created a fork (sorry for the horrible code and the fact that it currently needs python3-requests). I would be very glad if you could have a look at it.
The Following User Says Thank You to otsaloma For This Useful Post: | ||
|
2017-09-24
, 22:48
|
|
Posts: 141 |
Thanked: 1,530 times |
Joined on May 2011
@ Finland
|
#5
|
The Following User Says Thank You to otsaloma For This Useful Post: | ||
|
2017-09-25
, 06:31
|
Posts: 68 |
Thanked: 147 times |
Joined on Dec 2016
|
#6
|
Divide the times by 1000. The ones returned by the API seem to be milliseconds, we need seconds. I don't really know what exactly happens when you feed the formatting and filtering functions milliseconds, but correcting that seemed to fix it, I saw departures.
The Following User Says Thank You to bomo For This Useful Post: | ||
|
2017-09-25
, 18:51
|
Posts: 68 |
Thanked: 147 times |
Joined on Dec 2016
|
#7
|
request = requests.get(baseurl.format(url_i), params = parameter)
print(request.text)
[4,"2.0",1506365354592]
[3,"1@2017-09-20.14:18:29"]
[1,"Hainbuchenstraße","100636","",0,50.77811,6.0626 ,20,"33","33",1,"Vaals Busstation","Vaals Busstation","340","25000319020001",1506366480000]
[1,"Hainbuchenstraße","100636","",0,50.77811,6.0626 ,15,"33","33",1,"Aachen Fuchserde","Aachen Fuchserde","519","25000080013001",1506367166000]
[1,"Hainbuchenstraße","100636","",0,50.77811,6.0626 ,20,"33","33",1,"Vaals Busstation","Vaals Busstation","382","25000230013001",1506368220000]
[1,"Hainbuchenstraße","100636","",0,50.77811,6.0626 ,15,"33","33",1,"Aachen Fuchserde","Aachen Fuchserde","340","25000319021001",1506368760000]
[1,"Hainbuchenstraße","100636","",0,50.77811,6.0626 ,20,"33","33",1,"Vaals Busstation","Vaals Busstation","293","25000317023001",1506370020000]
[1,"Hainbuchenstraße","100636","",0,50.77811,6.0626 ,15,"33","33",1,"Aachen Fuchserde","Aachen Fuchserde","0","25000230014001",1506370560000]
[1,"Hainbuchenstraße","100636","",0,50.77811,6.0626 ,20,"33","33",1,"Vaals Busstation","Vaals Busstation","0","25000316023001",1506371820000]
[1,"Hainbuchenstraße","100636","",0,50.77811,6.0626 ,15,"33","33",1,"Aachen Fuchserde","Aachen Fuchserde","0","25000317024001",1506372360000]
parameter = {'ReturnList': returnlist, 'StopID': ','.join(map(str, stops)) }
body = urllib.parse.urlencode(parameter)
request = pan.http.post_json(baseurl.format(url_i), body)
print(request)
POST http://ivu.aseag.de/interfaces/ura/instant_V2
Establishing connection to ivu.aseag.de
[4, '2.0', 1506365172212]
The Following User Says Thank You to bomo For This Useful Post: | ||
|
2017-09-25
, 19:52
|
|
Posts: 141 |
Thanked: 1,530 times |
Joined on May 2011
@ Finland
|
#8
|
Is there anything in the code (apart from requests) that I need to change before it can be included on your builds?
For find_nearby I don't have an implementation because I don't know how to get it from the API. Would it be possible to remove this option depending on the selected provider ?
I am currently trying to get rid of request but I'm (again) struggling with pan.http.post
# For API endpoints that return JSON: result = pan.http.get_json(url) # For API endpoints that return text: result = pan.http.get(url, encoding="utf_8")
|
2017-10-06
, 18:29
|
|
Posts: 141 |
Thanked: 1,530 times |
Joined on May 2011
@ Finland
|
#10
|
Are you planning to support routing / journey planning also within pan transit?
The Following User Says Thank You to otsaloma For This Useful Post: | ||
Pan Transit is an application for Sailfish OS to view departures from public transport stops. It is designed to support multiple different providers (i.e. cities/regions). Currently supported are Helsinki Region Transport (HSL), Finnish Transport Agency, Transport for London and ASEAG in Aachen, Germany.
The dynamic plugin architecture should make it fairly easy for anyone with basic Python programming skills to add support for a new region. Providers only need to make API calls and transform that data to a format that Pan Transit understands and can display in its standard UI. Documentation is available at GitHub.
Please note that I do not plan to write providers for different regions myself, but will review and accept contributions from the community. Also, moderate suggestions to generalise the UI will be considered, but for very particular use cases, you might still be better of writing your own stand-alone app.
Download at OpenRepos or the Jolla store.
Source code and issue tracker at GitHub. Translations at Transifex.
Donations appreciated: paypal.me/otsaloma
Last edited by otsaloma; 2017-12-04 at 21:48.