| 1234567891011121314151617181920212223 |
- 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": "02S0wW15643928255d3ebd790ce04"}, timeout=30).result()
- if data:
- return data.content.decode('utf-8')
- except requests.exceptions.RequestException as e:
- print(e)
- @staticmethod
- def genearte_MD5(params):
- # 创建md5对象
- hl = hashlib.md5()
- hl.update(params.encode(encoding='utf-8'))
- return hl.hexdigest()
|