18 lines
313 B
Python
18 lines
313 B
Python
import requests
|
|
|
|
|
|
url = "http://127.0.0.1/login"
|
|
data = {
|
|
"username": "admin",
|
|
"password": "admin123"
|
|
}
|
|
r = requests.post(url, json=data)
|
|
token = r.json()["access_token"]
|
|
headers = {
|
|
"Cookie": token
|
|
}
|
|
print(token)
|
|
url = "http://127.0.0.1/users/me"
|
|
r = requests.get(url, headers=headers)
|
|
print(r.text)
|