19 lines
484 B
Python
19 lines
484 B
Python
from requests import get, post
|
|
|
|
ip = "http://192.168.0.209:8100"
|
|
param = {
|
|
"username": "tangchao",
|
|
"password": "123456a",
|
|
"client_id": "client",
|
|
"grant_type": "password",
|
|
"client_secret": "123456",
|
|
}
|
|
data = get(
|
|
url=f"{ip}/oauth/token?username=zhongwei&password=123456a&client_id=client&grant_type=password&client_secret=123456"
|
|
).json()
|
|
token = data["access_token"]
|
|
header = {
|
|
"content-type": "application/json",
|
|
"authorization": f"Bearer {token}",
|
|
}
|