|
@@ -14,7 +14,7 @@ import requests
|
|
|
from Crypto.Cipher import AES
|
|
|
|
|
|
from Ansjer.config import unicomAppUrl, unicomAppId, unicomAppSecret, unicomTenantId, \
|
|
|
- unicomEncodeKey, unicomIvKey, unicomUserName, unicomPassword, unicomPushKey
|
|
|
+ unicomEncodeKey, unicomIvKey, unicomUserName, unicomPassword, unicomPushKey, SERVER_DOMAIN_SSL
|
|
|
from Object.RedisObject import RedisObject
|
|
|
from Object.utils import SM3Util
|
|
|
from Object.utils.SymmetricCryptoUtil import AESencrypt
|
|
@@ -159,9 +159,10 @@ class UnicomObjeect:
|
|
|
@param re_data:
|
|
|
@return:
|
|
|
"""
|
|
|
- url = self.appUrl + '/platform/api/device/device-state'
|
|
|
+ url = self.appUrl + '/platform/api/device/async-device-state'
|
|
|
headers = self.business_unify_headers()
|
|
|
headers['content-type'] = 'application/json'
|
|
|
+ re_data['callbackUrl'] = SERVER_DOMAIN_SSL + 'unicom/api/device-status-change'
|
|
|
return requests.post(url, data=json.dumps(re_data), headers=headers)
|
|
|
|
|
|
def query_device_usage_history(self, **re_params):
|
|
@@ -306,3 +307,22 @@ class UnicomObjeect:
|
|
|
logger.info('再次停卡:{}'.format(response.text))
|
|
|
return True
|
|
|
return None
|
|
|
+
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+ unicom_api = UnicomObjeect()
|
|
|
+ # result = unicom_api.generate_token()
|
|
|
+ # result = unicom_api.refresh_token('5d0c0f30-99bd-4f17-9614-3524495b05d4')
|
|
|
+ params = {'iccid': '89860620170009631443', 'status': 1}
|
|
|
+ # response = unicom_api.verify_device(**params)
|
|
|
+ # response = unicom_api.query_device_status(**params)
|
|
|
+ response = unicom_api.update_device_state(**params)
|
|
|
+ # response = unicom_api.query_device_usage_history(**params)
|
|
|
+ # response = unicom_api.query_current_renew_list_usage_details(**params)
|
|
|
+ # unicom_api.get_device_batch_detail()
|
|
|
+ # response = unicom_api.query_package_list(**params)
|
|
|
+ # response = unicom_api.query_renewal_list(**params)
|
|
|
+
|
|
|
+ if response.status_code == 200:
|
|
|
+ res = json.loads(response.text)
|
|
|
+ print(res)
|