Timeout
trazola opened this issue · 8 comments
Hi,
I get a "timeout" error when using the Oauth2 client for Facebook.
Is it possible to set the timeout parameter?
Hi @trazola!
Could you give more details about the timeout you are getting? HTTPX has several kinds of timeout exceptions, so it would be worth to know which. Ideally, provide the stacktrace.
Could you confirm that you have access to the Facebook endpoint from your machine. You can try this cURL command for example:
curl -XPOST "https://graph.facebook.com/v5.0/oauth/access_token"
You should get a response like this:
{"error":{"message":"Missing redirect_uri parameter.","type":"OAuthException","code":191,"fbtrace_id":"APpAu3dZSPj8TxtKFOoSHzu"}}
Could you also try this and share the result:
curl -o /dev/null -s -w 'Establish Connection: %{time_connect}s\nTTFB: %{time_starttransfer}s\nTotal: %{time_total}s\n' "https://graph.facebook.com/v5.0/oauth/access_token"
It should give you the timings required to get the response:
Establish Connection: 0.028551s
TTFB: 0.142856s
Total: 0.143010s
The solution that helped me in another project where I was using HTTPX was to set the timeout value to a higher value.
httpx.AsyncClient(timeout=30.0)
I see, your connection time is surprisingly high, and HTTPX has a default timeout of 5 seconds. Are you behind a VPN or something?
I'll think about a way to tune HTTPX settings directly.
I've released a new version v0.7.0
, with the ability to customize the HTTPX client settings. You can see how in the documentation: https://frankie567.github.io/httpx-oauth/oauth2/#customize-httpx-client
Thank you for your help :).