Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
交易法门网站登录函数
:param account: user account
:type account: str
:param password: user password
:type password: str
:return: headers with cookies
:rtype: dict
"""
try:
pic_url = f"https://www.jiaoyifamen.com/captcha"
res = requests.get(pic_url)
f = Image.open(BytesIO(res.content))
f.show()
code = input()
c_func = execjs.compile(jymf_js.c.replace(r"\n", ""))
en_psw = c_func.call("e", password)
payload = {"nameOrEmail": account, "userPassword": en_psw, "captcha": code}
except:
c_func = execjs.compile(jymf_js.c.replace(r"\n", ""))
en_psw = c_func.call("e", password)
payload = {"nameOrEmail": account, "userPassword": en_psw}
res = requests.post(jyfm_login_url, json=payload, headers=jyfm_init_headers)
copy_jyfm_init_headers = jyfm_init_headers.copy()
copy_jyfm_init_headers["cookie"] = (
list(dict(res.cookies).keys())[0]
+ "="
+ list(dict(res.cookies).values())[0]
+ "; "
+ list(dict(res.cookies).keys())[1]
+ "="
+ list(dict(res.cookies).values())[1]
:param password: user password
:type password: str
:return: headers with cookies
:rtype: dict
"""
try:
pic_url = f"https://www.jiaoyifamen.com/captcha"
res = requests.get(pic_url)
f = Image.open(BytesIO(res.content))
f.show()
code = input()
c_func = execjs.compile(jymf_js.c.replace(r"\n", ""))
en_psw = c_func.call("e", password)
payload = {"nameOrEmail": account, "userPassword": en_psw, "captcha": code}
except:
c_func = execjs.compile(jymf_js.c.replace(r"\n", ""))
en_psw = c_func.call("e", password)
payload = {"nameOrEmail": account, "userPassword": en_psw}
res = requests.post(jyfm_login_url, json=payload, headers=jyfm_init_headers)
copy_jyfm_init_headers = jyfm_init_headers.copy()
copy_jyfm_init_headers["cookie"] = (
list(dict(res.cookies).keys())[0]
+ "="
+ list(dict(res.cookies).values())[0]
+ "; "
+ list(dict(res.cookies).keys())[1]
+ "="
+ list(dict(res.cookies).values())[1]
)
return copy_jyfm_init_headers