sig_request
Posted 两掺豆腐脑丶
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sig_request相关的知识,希望对你有一定的参考价值。
cms_teacher.py
# -*- coding: utf-8 -*-
"""
@Time : 2021/12/16 17:21
@Author : zero
"""
import requests
import time
import hashlib
a: 666
b: 777
class CMSApi(object):
def __init__(self, host, public_body=None):
# host = "http://192.168.31.72:8080"
self.host = host
self.secret_key = "irc_666."
self.session = requests.Session()
self.public_body = public_body
def get_sig(self, data_dict) -> str:
params_str = "".join(sorted([f"k=v" for k, v in data_dict.items()])) + self.secret_key
return hashlib.md5(params_str.encode("utf-8")).hexdigest()
def request(self, method, url, **kwargs):
print("kwargs ---", kwargs)
### 公共请求头
if "headers" in kwargs:
kwargs["headers"].update(time=time.strftime("%Y%m%d%H%M
以上是关于sig_request的主要内容,如果未能解决你的问题,请参考以下文章