frontend_sample.py
python_old/demo_backend/frontend_sample.py
##
'''
curl -i -s -X PUT "localhost:54321/users/1" \
-H "Content-Type: application/json"
-d '{"username":"john_doe_updated","email":"john.updated@example.com","age":26,"active":true}'
'''
## Use python requests to perform the same operation
import requests
url = "http://localhost:54321/users/1"
headers = {"Content-Type": "application/json"}
data = {
"username": "john_doe_updated",
"email": "john.updated@example.com",
"age": 26,
"active": True
}
response = requests.put(url, headers=headers, json=data)
print(response.status_code)
print(response.json())
Related articles
01_classical_caesar_cipher.py
01_classical_caesar_cipher.py — python source code from the python old learning materials (python_old/Cryptography/01_classical_caesar_cipher.py).
Read article →02_classical_monoalphabetic.py
02_classical_monoalphabetic.py — python source code from the python old learning materials (python_old/Cryptography/02_classical_monoalphabetic.py).
Read article →03_classical_rail_fence.py
03_classical_rail_fence.py — python source code from the python old learning materials (python_old/Cryptography/03_classical_rail_fence.py).
Read article →04_frequency_analysis.py
04_frequency_analysis.py — python source code from the python old learning materials (python_old/Cryptography/04_frequency_analysis.py).
Read article →05_cryptographic_hashing.py
05_cryptographic_hashing.py — python source code from the python old learning materials (python_old/Cryptography/05_cryptographic_hashing.py).
Read article →06_password_hashing.py
06_password_hashing.py — python source code from the python old learning materials (python_old/Cryptography/06_password_hashing.py).
Read article →