import riot_auth
async def authflow(user: str, passwd: str):
CREDS = user, passwd
auth = riot_auth.RiotAuth()
await auth.authorize(*CREDS)
await auth.reauthorize()
# Reauth using cookies. Returns a bool indicating whether the reauth attempt was successful.
await auth.reauthorize()
# print(f"Access Token Type: {auth.token_type}\n")
# print(f"Access Token: {auth.access_token}\n")
# print(f"Entitlements Token: {auth.entitlements_token}\n")
# print(f"User ID: {auth.user_id}")
return auth
这个代码再windows11下是能正常跑的,但是在linux的CentOS7.6中无法正常使用
python3 vesion 3.9.5
error handling command: login
Traceback (most recent call last):
File "/home/muxue/kook/bot/lib/python3.9/site-packages/khl/command/command.py", line 87, in handle
await self.execute(msg, *args)
File "/home/muxue/kook/bot/lib/python3.9/site-packages/khl/command/command.py", line 119, in execute
await self.handler(*args)
File "/home/muxue/kook/val_bot/code/main.py", line 731, in login_authtoekn
res_auth = await authflow(user, passwd)
File "/home/muxue/kook/val_bot/code/val.py", line 196, in authflow
auth = riot_auth.RiotAuth()
File "/home/muxue/kook/bot/lib/python3.9/site-packages/riot_auth/auth.py", line 78, in __init__
self._auth_ssl_ctx = RiotAuth.create_riot_auth_ssl_ctx()
File "/home/muxue/kook/bot/lib/python3.9/site-packages/riot_auth/auth.py", line 110, in create_riot_auth_ssl_ctx
libssl.SSL_CTX_set_ciphersuites(ssl_ctx_addr, RiotAuth.CIPHERS13.encode())
File "/usr/local/python3/lib/python3.9/ctypes/__init__.py", line 387, in __getattr__
func = self.__getitem__(name)
File "/usr/local/python3/lib/python3.9/ctypes/__init__.py", line 392, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/local/python3/lib/python3.9/lib-dynload/_ssl.cpython-39-x86_64-linux-gnu.so: undefined symbol: SSL_CTX_set_ciphersuites
有人告诉我这个是因为ssl版本不对应,我从源码升级了openssl的版本到1.1.1C
还是没能解决这个问题
代码来自这个项目https://github.com/floxay/python-riot-auth/