Hi,
I use “anvil.http.request” to access my host, but got “hostnam: Name or service not known”, any ideas why this happen?
Hi there, and welcome to the forum!
Can you post the code you’re using? How are you calling anvil.http.request()
?
Thanks for your reply, here is the code:
import anvil.http
@anvil.server.callable
def do_login(url, name, pwd):
r = anvil.http.request(url, method=‘POST’, data={“username”:name, “pwd”:pwd}).get_bytes()
…
What url
are you passing in?
That error message looks like you’re using a URL like "http://hostnam/"
, and it’s (rightly) complaining that it can’t find a web address called "hostnam"
.
Sorry for mislead, the hostname just a placeholder, it represents my server host name. The actual error message is “My server url: Name or service not known”. The url is my server url. I try in my side, it works fine.
If you don’t want to reveal your host name on the forum, please drop us an email at contact@anvil.works and we’ll take a look!