This repository has been archived on 2023-07-04. You can view files and clone it, but cannot push or open issues/pull-requests.
blog/test.py

20 lines
673 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/api/v1/sections", headers=headers, json=data)
print(r.content)
print(r.status_code)
r = requests.get("http://localhost:8000/api/v1/sections?offset=0&limit=100")
print(r.json())