V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  asmoker  ›  全部回复第 13 页 / 共 13 页
回复总数  244
1 ... 4  5  6  7  8  9  10  11  12  13  
2020-02-24 15:46:33 +08:00
回复了 5bb864e1fc775087 创建的主题 程序员 准备开发和钱有关的功能,还有哪些地方要注意
使用 BigDecimal,设置好 MathContext 和 RoundingMode。
@onevcat 哈哈 太皮了~
2020-02-03 10:41:08 +08:00
回复了 tenstone 创建的主题 程序员 有人用阿里云 OSS 的静态托管做博客吗?
需要域名备案,算了吧~
2019-07-02 19:19:52 +08:00
回复了 xuyl 创建的主题 Python 爬取某头条 h5 端接口, 无论如何都拿不到数据, 姿势不对?
难道是这样?两年前的方法了……

def _gen_req_params():
"""
生成请求头条 URL 必要的密钥参数
:return:
"""
# 响应结果
params = {
'as': '479BB4B7254C150',
'cp': '7E0AC8874BB0985'
}

# 当前时间戳
timestamp = int(math.floor(int(round(time.time() * 1000)) / 1000))
now = hex(timestamp)
now_str_number = now[2:len(now)].upper()
now_md5 = hashlib.md5(str(timestamp).encode()).hexdigest().upper()

# 计算 as 和 cp 参数
if len(now_str_number) == 8:
as_pre = ''
cp_pre = ''
first_five_char = now_md5[0:5]
last_five_char = now_md5[:-5]
for i in range(5):
as_pre += first_five_char[i] + now_str_number[i]
for j in range(5):
cp_pre += now_str_number[j + 3] + last_five_char[j]
as_result = "A1" + as_pre + now_str_number[-3:]
cp_result = now_str_number[0:3] + cp_pre + "E1"
params = {
'as': as_result,
'cp': cp_result
}
return params
1 ... 4  5  6  7  8  9  10  11  12  13  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3152 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 20ms · UTC 11:40 · PVG 19:40 · LAX 04:40 · JFK 07:40
Developed with CodeLauncher
♥ Do have faith in what you're doing.