I want to raise an error in my code if the status code of a request response is 429, which error should I use?
Exception
feels too broad and ValueError
doesn't seem right at all.
Does requests
have errors built-in I can use?
Or are there standard ways of handling things like this that I am not aware of?
Pseudo-code example
import requests
response = requests.request('GET', url)
if response.status_code == 200:
continue
elif response.status_code == 429:
raise Exception('''You made too many requests, please wait a
minute and then try again''')