trainline-python icon indicating copy to clipboard operation
trainline-python copied to clipboard

403 error systematically

Open fredtostaky opened this issue 1 year ago • 2 comments

  • trainline version: 0.1.2
  • Python version: Python 3.7.12
  • Operating System: Ubuntu 22.04

Description

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())

What I Did


ConnectionError: Status code 403 for url https://www.trainline.eu/api/v5_1/search
{"url":"https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMAlKNr1QJizNQAmE2fxQ==&cid=8xF~oUzPNL-oYo39IbiOCm6bsa07Cczk449-C5qcIlqEYLyQRKMnipNjrzunDh7j4fAy0_YdSq~qhEPSd0w73WxlGhLCy~qtybii6zkYYvkzpIUBELc3A9GvOjVIaOp&referer=HTTPS%3A%2F%2Fwww.trainline.eu%2Fapi%2Fv5_1%2Fsearch&hash=E1950F58FF4C3B67C237DE42A4D080&t=fe&s=35668&e=6418b8f16dabeec967beb95265b8b63962e2c4166ca4b41593d3e90c3995fb34"}

fredtostaky avatar Apr 11 '23 08:04 fredtostaky

Hello, The error is due to the anti-bot protection from Datatome. which protects Trainline's APIs from scraping.

said026 avatar May 02 '23 09:05 said026

Is there any work-around this protection ?

supercairos avatar Apr 03 '24 08:04 supercairos