Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- """
- api_endpoint is the custom endpoint that returns your desired
- response based on whether or not Django Server is ready to take
- on requests
- """
- response = requests.get(api_endpoint)
- while response.status_code != 200:
- time.sleep(1) # Sleep for 1 second
- response = requests.get(api_endpoint)
- # Once this while loop breaks, this indicates we are good to proceed
- if response.status_code == 200:
- # Do rest of your job here
Add Comment
Please, Sign In to add comment