This repository has been archived on 2023-07-04. You can view files and clone it, but cannot push or open issues/pull-requests.
2021-11-23 20:21:29 +01:00
|
|
|
import requests
|
|
|
|
|
2021-11-23 20:31:54 +01:00
|
|
|
# Token specifically used for testing. It's signed with secret "secret" & expires in 2034 or something
|
|
|
|
token = "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjVjMjM2OTI0NjY4ZDQzZWFiNGNmNDczYjk1YWZiNzgzIiwidXNlcm5hbWUiOiJKb2huIERvZSIsImFkbWluIjp0cnVlLCJleHAiOjE1MTYyMzkwMjIwfQ.if939L9le8LP-dtXnQs-mHPkb-VieRAvAfSu20755jY"
|
2021-11-23 20:21:29 +01:00
|
|
|
|
|
|
|
headers = {
|
|
|
|
"Authorization": f"Bearer {token}"
|
|
|
|
}
|
|
|
|
print(headers)
|
|
|
|
data = {
|
|
|
|
"title": "sometitle",
|
|
|
|
"shortname": "short",
|
|
|
|
}
|
|
|
|
|
2021-11-28 21:45:29 +01:00
|
|
|
r = requests.post("http://localhost:8000/api/v1/sections", headers=headers, json=data)
|
2021-11-23 20:21:29 +01:00
|
|
|
print(r.content)
|
|
|
|
print(r.status_code)
|
2021-11-28 21:45:29 +01:00
|
|
|
r = requests.get("http://localhost:8000/api/v1/sections?offset=0&limit=100")
|
2021-11-23 20:31:54 +01:00
|
|
|
print(r.json())
|