1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- import requests
- url = 'http://127.0.0.1:9000/v1/token'
- data = {
- 'username': 'admin',
- 'password': '123456',
- }
- response = requests.post(url=url, json=data)
- code = response.json().get('code')
- token = response.headers.get('authorization')
- url = 'http://58.34.94.177:29101/v6/api'
- data = {
- 'code': 3001,
- 'page': 1,
- 'size': 3,
- 'pid': 'AA',
- 'driver_name': 'AABBXX',
- }
- response = requests.post(url=url, json=data, headers={'authorization': token})
- print(response.json())
- """
- {
- 'code': 0,
- 'data': [
- {
- 'uuid': '65dbe96949fbe311a3a01d30',
- 'pid': 'AA112233',
- 'start_time_at': 1708917227,
- 'end_time_at': 1708946027,
- 'driver_name': '张三',
- 'cockpit_name': '1号舱'
- }
- ],
- 'total': 1,
- 'page': 1,
- 'size': 3
- }
- """
- url = 'http://58.34.94.177:29101/v6/api'
- params = {'code': 3002}
- response = requests.get(url=url, params=params, headers={'authorization': token})
- print(response.text)
- requests.get(url='http://58.34.94.177:29101/v6/api?code=3002').text
|