Answer the question
In order to leave comments, you need to log in
How to check if the server is running or not?
I want to check if the server is running before making a get request.
import requests, json
# get
url = "http://127.0.0.1:8000/"
try :
res = requests.get(url+r'/get')
pars= json.loads(res.content.decode('utf-8'))
print(pars)
except ConnectionRefusedError:
print('bad')
[WinError 10061] Connection not established because the destination computer rejected the connection request
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question