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

All requests give 400 error #18

Open
baptistesola2 opened this issue Jan 12, 2021 · 4 comments
Open

All requests give 400 error #18

baptistesola2 opened this issue Jan 12, 2021 · 4 comments

Comments

@baptistesola2
Copy link

trainline version: 0.1.0
Python version: 3.7
Operating System: macOS

Description
All requests return the same error:
requests.exceptions.ConnectionError: Status code 400 for url https://www.trainline.eu/api/v5_1/search
{"error":{"code":"no_results","message":{}}}

Basically the same issue as last time

@yann120
Copy link

yann120 commented Jul 11, 2022

Hey, now I have a 403
requests.exceptions.ConnectionError: Status code 403 for url https://www.trainline.eu/api/v5_1/search
Someone has a fix ? Or I will try to dig into it to fix it

@pmontp19
Copy link

I also found a 403. It seems that the API has like a captcha? Is that possible?

python3 trainline_cli.py --departure="Toulouse" --arrival="Bordeaux" --next=12hours
Traceback (most recent call last):
  File "/Users/PERE/Developer/trainline-python/trainline_cli.py", line 104, in <module>
    main()
  File "/Users/PERE/Developer/trainline-python/venv-trainline/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/PERE/Developer/trainline-python/venv-trainline/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/PERE/Developer/trainline-python/venv-trainline/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/PERE/Developer/trainline-python/venv-trainline/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/PERE/Developer/trainline-python/trainline_cli.py", line 70, in main
    results = trainline.search(
  File "/Users/PERE/Developer/trainline-python/trainline/__init__.py", line 677, in search
    ret = t.search(
  File "/Users/PERE/Developer/trainline-python/trainline/__init__.py", line 160, in search
    ret = c._post(url=_SEARCH_URL, post_data=post_data)
  File "/Users/PERE/Developer/trainline-python/trainline/__init__.py", line 88, in _post
    raise ConnectionError(
requests.exceptions.ConnectionError: Status code 403 for url https://www.trainline.eu/api/v5_1/search
{"url":"https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMADQxA6obKnNEAX6nnHQ==&cid=TIdsiBV~EcDHE_IAtNj5spBysTm5cthZiZJwl4CQQpF~~_KKIyorpuVdNaCwnDGqKoYe~WBoSxNxj9RAGo5ZD-3V1y2~GZ~Yl4leInQ7cHy6XJPiBbbL8hQFRCBcNc4&referer=HTTPS%3A%2F%2Fwww.trainline.eu%2Fapi%2Fv5_1%2Fsearch&hash=E1950F58FF4C3B67C237DE42A4D080&t=fe&s=35668&e=e4548cb61358ab5c28bc447a910ffc1e70a0207a18fa3f5a152d475e9a68687d"}

You can see it in the request response. Going to this URL it says something about your browser behavior intrigued us. So it seems that they implemented some kind of protection agains this.

@pmontp19
Copy link

Well it seems that this issue is not new, same as #20 and is from last year.

@fredtostaky
Copy link

Same here, 403, no activity since long time from td, hope he will come back to his github T_T

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

No branches or pull requests

4 participants