Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BiciMAD (Madrid) need an accessToken #524

Closed
Manu1400 opened this issue Dec 21, 2022 · 2 comments · Fixed by #532
Closed

BiciMAD (Madrid) need an accessToken #524

Manu1400 opened this issue Dec 21, 2022 · 2 comments · Fixed by #532

Comments

@eUgEntOptIc44
Copy link
Contributor

Hi @Manu1400 @eskerda

TL;DR It took me quite a while but I managed to fix this. -> please see eUgEntOptIc44@66efe06

Unfortunately adding the accessToken mentioned by @Manu1400 didn't worked for me. It seems to be a placeholder or leftover from testing with Postman while documenting the api. Anyways the authentication fails and a error is returned.

So I dug deeper to discover that a account is required to generate a token. The token is only valid during the session. Furthermore a valid (Spanish?) mobile number is required to verify the account. All in all bad news for a possible integration into pybikes.

Searching the 'news' section of Madrid's Mobility Labs I discovered a map dashboard powered by ArcGIS at mynavega.emtmadrid.es. Despite the slightly dated impression it's fully functional and using some sort of proxy/loadbalancer to use the api data endpoints.

So using https://mynavega.emtmadrid.es/services/api/BiciMadrid/GetAllStationsInfo with the referrer header set to https://mynavega.emtmadrid.es/?locale=es works to get the bike sharing data. 🥳

However I had to implement some minor adaptions to access the json encoded results within the json encoded request answer. This seems to be caused by the mentioned proxy/loadbalancer used for the map.

@eskerda
Copy link
Owner

eskerda commented Dec 29, 2022

So I dug deeper to discover that a account is required to generate a token. The token is only valid during the session. Furthermore a valid (Spanish?) mobile number is required to verify the account. All in all bad news for a possible integration into pybikes.

We accept implementations requiring an access token, as long as this access token is something that can be reasonably accessed. See https://github.com/eskerda/pybikes/blob/master/pybikes/cyclocity.py for an example

I will dug deeper into their android app to see if there's any shortcut. While not ideal, I think it's reasonable to expect a token from https://mobilitylabs.emtmadrid.es/es/portal/mobilitylabs

eskerda added a commit that referenced this issue Jan 14, 2023
change data feed for Bicimad (Madrid, ES) (fixes #524)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants