20 lines
659 B
Python
20 lines
659 B
Python
import requests
|
|
|
|
# Token specifically used for testing. It's signed with secret "secret" & expires in 2034 or something
|
|
token = "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjVjMjM2OTI0NjY4ZDQzZWFiNGNmNDczYjk1YWZiNzgzIiwidXNlcm5hbWUiOiJKb2huIERvZSIsImFkbWluIjp0cnVlLCJleHAiOjE1MTYyMzkwMjIwfQ.if939L9le8LP-dtXnQs-mHPkb-VieRAvAfSu20755jY"
|
|
|
|
headers = {
|
|
"Authorization": f"Bearer {token}"
|
|
}
|
|
print(headers)
|
|
data = {
|
|
"title": "sometitle",
|
|
"shortname": "short",
|
|
}
|
|
|
|
r = requests.post("http://localhost:8000/sections", headers=headers, json=data)
|
|
print(r.content)
|
|
print(r.status_code)
|
|
r = requests.get("http://localhost:8000/sections?offset=0&limit=100")
|
|
print(r.json())
|