import requests,json
def getToken():
url = 'http://10.1.1.92:8989/interfaceAuto/getAuthToken'
par = {
"appId": "e680a6997c3e4b45a15987412afef5f7",
"appKey": "GHeziQed",
"appSecret": "bc0849a175c2950c6b2302faf2ab3737"
}
resp = requests.post(url, json=par).json()
token = resp['result']['accessToken']
return token
def sendRequest(self):
url = 'http://10.1.1.92:8909/interfaceAcq/pullData'
par = {
"appId": "e680a6997c3e4b45a15987412afef5f7",
"accessToken": getToken(),
"shipEquipment": {
"shipName":"海洋石油577",
"data": self.getMessage()
}
}
resp = requests.post(url, json=par)
return resp.text
def main():
print(1111)
if __name__ == '__main__':
with open(r'C:\Users\Administrator\Desktop\new1.txt', 'r', encoding='utf-8') as f:
message = f.readline()
main()