Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

46 строки
771 B
Python

import requests
# GET
payload = {'key1': 'value1', 'key2': 'value2'}
response = requests.get(
'https://api.github.com/',
params=payload
)
print("Status Code", response.status_code)
print("Response content ", response.text)
# POST
payload = {
"id": 1001,
"name": "geek",
"passion": "coding",
}
response = requests.post(
'https://httpbin.org/post',
json=payload)
print("Status Code", response.status_code)
print("JSON Response ", response.json())
# DELETE not allowed
# POST
payload = {
"id": 1001,
"name": "geek",
"passion": "coding",
}
response = requests.delete(
'https://httpbin.org/post',
json=payload)
print("Status Code", response.status_code)
print("JSON Response ", response.json())