| 12345678910111213141516171819202122232425262728293031323334 |
- import hashlib
- import json
- import requests
- from requests_futures.sessions import FuturesSession
- class Helper(object):
- @staticmethod
- def async_post(url, params):
- try:
- fs_session = FuturesSession()
- data = fs_session.post(url, data={"data": json.dumps(params), "token": "u4Gdf015662654065d5b503ea2517"}, timeout=180).result()
- if data:
- return data.json()
- except requests.exceptions.RequestException as e:
- print(e)
- @staticmethod
- def genearte_MD5(params, pt):
- # 创建md5对象
- hl = hashlib.md5()
- pn = int(pt)
- if pn == 3:
- param = params + str(pt)
- else:
- param = params
- hl.update(param.encode(encoding='utf-8'))
- return hl.hexdigest()
- @staticmethod
- def genearte_uuid(params):
- hl = hashlib.md5()
- hl.update(params.encode(encoding='utf-8'))
- return hl.hexdigest()
|