Python Requests status code

After sending an HTTP request with Requests, it is common to check the status code of the response.

import requests

response = requests.get(...)

assert response.status_code == 200

And so on. However, at this time, using the Requests constant,

assert response.status_code == requests.codes.ok

And so on. This way you don't have to use the magic number 200.

Recommended Posts

Python Requests status code
python character code
Python code acceleration approach
Rewrite Python2 code to Python3 (2to3)
infomap python draw code
Before writing Python code
About Python3 character code
Retry with python requests
OpenCV basic code (python)
Get country code with python
Python with VS Code (Windows 10)
Save images using python3 requests
Aim python library master (18) requests
Python code memo for yourself
[Python] Frequently used library code
Debug Python with VS Code
2.x, 3.x character code of python
Stop Omxplayer from Python code
Python frequently used code snippets
Generate QR code in Python
python beautifulsoup requests glob find_all
[Python] Sample code for Python grammar
Character code learned in Python
Convert python 3.x code to python 2.x
Document Python code with Doxygen
[Python] Create a screen for HTTP status code 403/404/500 with Django
Retry post request using python requests
That Python code has no classes ...
Python
How to use Requests (Python Library)
Automatically format Python code in Vim
[Python] POST wav files with requests [POST]
Get the weather with Python requests 2
[Code] Module and Python version output
Write selenium test code in python
Execute Python code from C # GUI
[Python] Read the Flask source code
Code tests around time in Python
Send multipart / form-data with python requests
[VS Code] ~ Tips when using python ~
Install python with mac vs code
requests
Installation of Visual studio code and installation of python
Fourier series verification code written in Python
Execute Python code on C ++ (using Boost.Python)
python> link> strftime () and strptime () behavior / code
Write test-driven FizzBuzz code using Python doctest.
Getting Python source code metrics using radon
[Python3] Rewrite the code object of the function
Log in to Slack using requests in Python
Enumerate duplicate combinations (C ++) → Add Python code
python> coding guide> PEP 0008 --Style Guide for Python Code
Run Python code on A2019 Community Edition
[Python] Get the character code of the file
Call APIGateWay with APIKey in python requests
Get the EDINET code list in Python
[Note] Execute Python code from Excel (xlwings)
Notes on using code formatter in Python
Status of each Python processing system in 2020
R code compatible sheet for Python users
python setup.py test the code using multiprocess