When to use `raise_for_status` vs `status_code` testing
I have always used: r = requests.get(url) if r.status_code == 200: # my passing code else: # anything else, if this even exists Now I was working on another issue and decided to allow for other errors and am instead now using: try: r = requests.get(url) r.raise_for_status() except requests.exceptions.ConnectionError as err: # eg, no internet raise SystemExit