Home > Back-end >  Issue using python request module
Issue using python request module

Time:02-20

Good morning, Since yesterday, I'm having timeouts doing requests to ebay website. The code is simple:

import requests
headers = {
        "User-Agent": 
            "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"}

htlm=requests.get("https://www.ebay.es",headers=headers).text

Tested with google and it works. This is the response I receive: '\nGateway Timeout - In read \n\n

Gateway Timeout

\nThe proxy server did not receive a timely response from the upstream server.

\nReference #1.477f1602.1645295618.7675ccad\n\n'

What happened or changed? How could I solve it?

CodePudding user response:

Removing the headers should work. Perhaps they don't like that user agent for some reason.

import requests
# headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"}
headers = {}
url = "https://www.ebay.es"

response = requests.get(url, headers=headers)
html_text = response.text
  • Related