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
665 B
Python
Raw Permalink Normal View History

2021-11-23 20:21:29 +01:00
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"
2021-11-23 20:21:29 +01:00
headers = {
"Authorization": f"Bearer {token}"
}
print(headers)
data = {
"title": "sometitle",
"shortname": "short",
}
2021-12-26 17:56:19 +01:00
r = requests.post("http://localhost:8001/v1/sections", headers=headers, json=data)
2021-11-23 20:21:29 +01:00
print(r.content)
print(r.status_code)
2021-12-26 17:56:19 +01:00
r = requests.get("http://localhost:8001/v1/sections?offset=0&limit=100")
print(r.json())