3
I have the following HTTP request code on my server in my python code:
import urllib.request
import json
url= urllib.request.urlopen('http://ENDERECOIP/pasta/arquivo.php')
x= url.read()
y = json.loads(x.decode('utf-8'))
teste = y['valor']
print(teste)
The code works and returns the value but I wanted to do a previous check in case the server is not available it returns a message "Server unavailable".
If the server is available, what would be the response to your request?
– Woss