0

I have requests installed already and yes it is up to date. Importing requests, writing down headers and writing down URL is fine. They return the >>> prompt. When I write:

>>> res = requests.get(url, headers=headers)

nothing returns. I don't even get the >>> prompt. everything else i write after this do not respond, does not have the >>> and is only black in colour.

karthikr
  • 92,866
  • 25
  • 190
  • 186
OCY
  • 1

1 Answers1

1

You need to pass in a timeout, allowing the call to stop after a certain amount of time.

Replace

res = requests.get(url, headers=headers)

with

r = requests.get(
    url,
    headers=headers,
    timeout=5
)
Will
  • 4,048
  • 2
  • 21
  • 43