0

Seem that the trainline code from github not get update anymore, and seems that trainline put a captcha on there API (that's weird to have an API and denied automated request?).

Here a classic request :

import trainline

results = trainline.search(
    departure_station="Toulouse",
    arrival_station="Bordeaux",
    from_date="15/05/2023 08:00",
    to_date="15/05/2023 21:00")

print(results.csv())

And the response I have :

ConnectionError: Status code 403 for url https://www.trainline.eu/api/v5_1/search
{"url":"https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMAjc7NvuMc1-kAmE2fxQ==&cid=3cneS4bIqyQjolPz_BQy~m_bu1F8-uV~KPMgNdzVETdBGa4RFJQvgeDrAVm65Rr2lTdpnLmnPudOelmJUBR333HwK1kgw_kuF2r9yR7xdXF5Qevc~5XwrC_~9THTUOo3&referer=HTTPS%3A%2F%2Fwww.trainline.eu%2Fapi%2Fv5_1%2Fsearch&hash=E1950F58FF4C3B67C237DE42A4D080&t=fe&s=35668&e=2da88a87b527202aa76683a4f2aefb0a121b92be29581f57e072775864da80c1"}

I just don't have enought knowledge in Python to integrate the captcha resolution service in the ini.py from trainline ; I think it could be very simple, isn't ?

It would be very, very, veeery appreciated if someone could help me on this, I'm about to show this tool in my lab to convince people that train is possible to our displacements ^^.

BenjiBoy
  • 141
  • 7

0 Answers0