|
|
@@ -1,25 +1,78 @@
|
|
|
+import hashlib
|
|
|
+import requests
|
|
|
+import time
|
|
|
+import json
|
|
|
+from aliyunsdkcore.vendored.requests.auth import HTTPBasicAuth
|
|
|
|
|
|
|
|
|
+def sim_info(iccid):
|
|
|
+ # 时间戳 用于获取sign
|
|
|
+ timestamp = int(time.time())
|
|
|
+ current_milli_time = lambda: int(round(time.time() * 1000))
|
|
|
+ data_1 = "appid=%s&iccid=%s×tamp=%s%s"%("102420177762",iccid,current_milli_time(),"6397d7e6a56589f1d93284e9800493e1")
|
|
|
+ sign = hashlib.sha256(data_1.encode('utf-8')).hexdigest()
|
|
|
+ data = {"appid": "102420177762", "iccid": iccid, "timestamp":current_milli_time(),"sign":sign}
|
|
|
+ url = "https://api.simboss.com/2.0/device/detail"
|
|
|
+ try:
|
|
|
+ status = 1
|
|
|
+ ret = requests.post(url, data=data)
|
|
|
+ code = json.loads(ret.text)["code"]
|
|
|
+ print("第一个:", json.loads(ret.text))
|
|
|
+ if code == "0":
|
|
|
+ status = 1
|
|
|
+ else:
|
|
|
+ url = 'http://sim.brlink.cn/api/open/iotcard/card'
|
|
|
+ appkey = "iaO2DKgS8KdlnVgU"
|
|
|
+ appsecret = "qzKgO4sBdzMrjRwv9H22S9ufepNv8Hl5ehPqkYVD31DCICjyKwqUdj7zihQQKfgx"
|
|
|
+ status = 2
|
|
|
+ ret = requests.post(url,json={'iccid':iccid},auth=HTTPBasicAuth(appkey,appsecret),timeout=(5,10))
|
|
|
+ codes = json.loads(ret.text)["code"]
|
|
|
+ print("第二个:", json.loads(ret.text))
|
|
|
+ if codes == 0:
|
|
|
+ status = 2
|
|
|
+ else:
|
|
|
+ # try:
|
|
|
+ # url = "https://jsnl.xmnengjia.com/open/api/module/cards"
|
|
|
+ # data = {"iccids":[iccid]}
|
|
|
+ # data = json.dumps(data)
|
|
|
+ # ret = requests.post(url,data=data,timeout=(10,30))
|
|
|
+ # result = json.loads(ret.text)
|
|
|
+ # print("第三个:", json.loads(ret.text))
|
|
|
+ # expiry_date = result.get("data", {}).get("expiry_date")
|
|
|
+ # except Exception as e:
|
|
|
+ userId = 137
|
|
|
+ timestamp_now = int(time.time())
|
|
|
+ apikey = "2ae46f82215a187ba22656db9a9848d8"
|
|
|
+ text = f"userId={userId}&apikey={apikey}×={timestamp_now}"
|
|
|
+ md5 = hashlib.md5()
|
|
|
+ md5.update(text.encode('utf-8'))
|
|
|
+ sign = (md5.hexdigest()).upper()
|
|
|
+ url = f"http://hywx.xjict.com:32040/api/v1/getChaxun?userId={userId}&cardno={iccid}×={timestamp_now}&sign={sign}"
|
|
|
+ ret = requests.get(url,timeout=(10,30))
|
|
|
+ print("第四个:", json.loads(ret.text))
|
|
|
+ status = 4
|
|
|
+ except:
|
|
|
+ status = 0
|
|
|
+ ret = 0
|
|
|
+ day = 0
|
|
|
+ if ret:
|
|
|
+ try:
|
|
|
+ result = json.loads(ret.text)
|
|
|
+ expiry_date = result.get("data", {}).get("expiry_date")
|
|
|
+ now_date = int(time.time())
|
|
|
+ time_difference = int((expiry_date - now_date) / 3600 / 24)
|
|
|
+ print(time_difference)
|
|
|
+ if time_difference < 30:
|
|
|
+ return [0,"有效期剩余{}天".format(time_difference)]
|
|
|
+ elif time_difference >= 181:
|
|
|
+ return [1,"有效期剩余{}天".format(time_difference)]
|
|
|
+ else:
|
|
|
+ return [2,"有效期剩余{}天".format(time_difference)]
|
|
|
+ except:
|
|
|
+ return [0, "查询无结果"]
|
|
|
+ else:
|
|
|
+ return [0, "查询无结果"]
|
|
|
|
|
|
-# -*- coding: utf-8 -*-
|
|
|
-import oss2
|
|
|
|
|
|
-# 从环境变量中获取访问凭证。运行本代码示例之前,请确保已设置环境变量OSS_ACCESS_KEY_ID和OSS_ACCESS_KEY_SECRET。
|
|
|
-auth = oss2.Auth('LTAI4G7tFh5Nk4KXZoSPk1D8', 'RV4S2SfbLPoFNjlI4uIOoA0J1LQPQc')
|
|
|
-# yourEndpoint填写Bucket所在地域对应的Endpoint。以华东1(杭州)为例,Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。
|
|
|
-# 填写Bucket名称。
|
|
|
-# -internal
|
|
|
-oss_url, bt = "https://oss-cn-hangzhou.aliyuncs.com", "bigdata-image"
|
|
|
-bucket = oss2.Bucket(auth, oss_url, bt)
|
|
|
-
|
|
|
-# 填写Bucket名称,例如examplebucket。
|
|
|
-# 指定图片所在Bucket的名称。如果图片不在Bucket根目录,需携带文件完整路径,例如exampledir/example.jpg。
|
|
|
-key = '192.168.1.148_01_20230608140200248_ALARM_INPUT.jpg'
|
|
|
-
|
|
|
-# 如果图片不在指定Bucket内,需将该图片到目标Bucket。
|
|
|
-# bucket.put_object_from_file(key, 'D:\\localpath\\example.jpg')
|
|
|
-# 将图片缩放为固定宽高100 px后,再旋转90°。
|
|
|
-style = 'image/resize,m_fixed,w_100,h_100/rotate,90'
|
|
|
-# 生成带签名的URL,并指定过期时间为10分钟。过期时间单位为秒。
|
|
|
-url = bucket.sign_url('GET', key, 10 * 60, params={'x-oss-process': style})
|
|
|
-print(url)
|
|
|
+# for i in iccids_list:
|
|
|
+sim_info("898604F81623D0406531")
|