python3实现简单的接口调用
日常记录:#!/usr/bin/env python# -*- coding: utf-8 -*-import requestsimport jsonimport unittesturl = 'https:xxxxx.userTag'headers = {"X-TOKEN": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzIxxxxxxxRJZCI6InFp...
·
日常记录:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import json
import unittest
url = 'https:xxxxx.userTag'
headers = {
"X-TOKEN": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzIxxxxxxxRJZCI6InFpdXNoaTYiLCJ1c2VySWQiOjEwODQ4MzY3LCJ1c2VyVHlwZSI6ImJ1aWxkLWluIiwidXNlck5hbWUiOiJsYyIsImV4dCI6MTU3MzMyNzg4NzgwNywiaWF0IjoxNTczMjg0Njg3ODA3fQ._kHJPVGfUVVJMYagImuceMrLh3snWNVzw9uWfYFWEIc",
"Content-Type": "application/json"
}
data = {
"groupId": 101,
"tagName": "xxxx",
"valueType": 1,
"optionType": 1,
"valueNumberOption": 0,
"validPeriodType": 0,
"validPeriod": 1,
"description": ""
}
def send_post(url,data,headers):
res = requests.post(url=url,data=json.dumps(data),headers=headers)
return res.json()
print(send_post(url,data,headers))
更多推荐



所有评论(0)