explodinglabs / jsonrpcclient

Generate JSON-RPC requests and parse responses in Python

Home Page:https://www.jsonrpcclient.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to set timeout for HTTPClient.

peilun-conflux opened this issue · comments

Sorry, I didn't find the proper way to set the timeout for HTTPClient and is currently hacking requests to achieve this.

Is it not supported yet or am I missing any feature?

commented

You can't with request (or notify), but you can with send:

client.send(Request("ping"), timeout=10)

Hi @bcb
I am also trying to set a timeout for this call: response = request("http://" + ipEntry.get() + port, "temperature_test", x) .
Now I tried: response = client.send(request("http://" + ipEntry.get() + port, "temperature_test", x), timeout=10) but I get the errormessage: NameError: name 'client' is not defined. Which module do I need to import to get this work? I am thankful for any hints and answers. Best regards, pfra17

commented

@pfra17 you need a capital r Request, which is a class, not a function, shown here https://jsonrpcclient.readthedocs.io/en/latest/api.html