The Sankaku library (version 1.0.3) encounters a 500 error when logging into the huggingface space environment.
import asyncio
from sankaku import SankakuClient
async def main():
client = SankakuClient()
await client.login(login='username', password='password')
if __name__ == '__main__':
asyncio.run(main())
The output result is:
Traceback (most recent call last):
File "test_login.py", line 12, in <module>
asyncio.run(main())
File "/usr/local/lib/python3.8/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 612, in run_until_complete
return future.result()
File "test_login.py", line 8, in main
await client.login(login='username', password='password')
File "/home/user/.local/lib/python3.8/site-packages/sankaku/clients/clients.py", line 92, in login
await self._login_via_credentials(login, password) # type: ignore[arg-type]
File "/home/user/.local/lib/python3.8/site-packages/sankaku/clients/clients.py", line 38, in _login_via_credentials
response = await self._http_client.post(
File "/home/user/.local/lib/python3.8/site-packages/sankaku/clients/http_client.py", line 94, in post
return await self.request("POST", url, **kwargs)
File "/home/user/.local/lib/python3.8/site-packages/sankaku/clients/http_client.py", line 71, in request
raise errors.SankakuServerError(
sankaku.errors.SankakuServerError: [500] Invalid response content type: content_type=text/html.
I tried to output the text in the response, and it contains:
<html>
<head><title>500 Internal Server Error</title></head>
<body>
<center><h1>500 Internal Server Error</h1></center>
<hr><center>nginx</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
However, when running locally and on several other servers, this issue did not occur, and the login was successful. Therefore, it is possible that some necessary configurations (such as Referer, User-Agent, etc.) are missing during the login. Is it possible to optimize this?
BTW: You can check the huggingface space here: https://huggingface.co/spaces/narugo/jupyterlab and duplicate it for testing in a real environment.
The Sankaku library (version 1.0.3) encounters a 500 error when logging into the huggingface space environment.
The output result is:
I tried to output the text in the response, and it contains:
However, when running locally and on several other servers, this issue did not occur, and the login was successful. Therefore, it is possible that some necessary configurations (such as Referer, User-Agent, etc.) are missing during the login. Is it possible to optimize this?
BTW: You can check the huggingface space here: https://huggingface.co/spaces/narugo/jupyterlab and duplicate it for testing in a real environment.