Back To All FAQs

Why Am I Getting a Timeout Error When Connecting To Web3?

We’ve seen this issue a few times from customers attempting to connect to Web3.

w3 = Web3(HTTPProvider(““))   —   error: timeout

There is no timeout with HTTPProvider but there can be a timeout with the response the user is expecting.

The suggested solution is to increase the timeout value when creating the web3 object.

Web3(HTTPProvider(<span class="hljs-string">"</span><a href="" rel="nofollow noreferrer"><span class="hljs-string"></span></a><span class="hljs-string">"</span>, request_kwargs={<span class="hljs-string">'timeout'</span>: <span class="hljs-number">60</span>})) \\instead <span class="hljs-keyword">of</span> <span class="hljs-keyword">default</span> <span class="hljs-number">10</span>