juancarlospaco / faster-than-requests

Faster requests on Python 3
https://gist.github.com/juancarlospaco/37da34ed13a609663f55f4466c4dbc3e
MIT License
1.11k stars 90 forks source link

how to set timeout time when requesting get and post request #162

Closed abhi00031 closed 3 years ago

abhi00031 commented 3 years ago

how to set timeout time when requesting get and post request ?

juancarlospaco commented 3 years ago

timeout = 1_000 in the arguments.

Millisecond precision so multiply by 1000.

abhi00031 commented 3 years ago

I tried this but i am getting the below response from server 'status': '401 Unauthorized'. When i don't put the timeout argument i am getting desired response from server

juancarlospaco commented 3 years ago

But it says you are not authorized.

Timeout is not related to auth whatsoever.

juancarlospaco commented 3 years ago

Maybe try debugging the HTTP operation itself using Postman or Insomnia ?.

abhi00031 commented 3 years ago

ok Will try debugging

abhi00031 commented 3 years ago

is the below line correct? response=ftr.get2str(url,timeout=50000)

I noticed that when i use get() function i am getting response as unauthorized but when i use get2str() method i get the requested data.. why is it so ?