mixmoe / HibiAPI

一个实现了多种常用站点的易用化API的程序 / A program that implements easy-to-use APIs for a variety of commonly used sites.
https://api.obfs.dev
Apache License 2.0
548 stars 83 forks source link

TypeError: unsupported format string passed to `IPv4Address.__format__` #300

Closed Ruriko closed 2 years ago

Ruriko commented 2 years ago

When I try to visit any endpoint for pixiv it gives error: {"url": "http://195.170.xxx.xxx:8032/api/pixiv/rank", "time": "2022-05-30T14:01:53.357965", "code": 500, "detail": "TypeError", "headers": {}}

2022-05-30 13:59:48.238 | WARNING  | hibiapi.__main__:main:79 -                                                                                                                                                                                                                                        
                                                                                                    _    _ _ _     _          _____ _____                                                                                                    
                                                                                                   | |  | (_) |   (_)   /\   |  __ \_   _|                                                                                                   
                                                                                                   | |__| |_| |__  _   /  \  | |__) || |                                                                                                     
                                                                                                   |  __  | | '_ \| | / /\ \ |  ___/ | |                                                                                                     
                                                                                                   | |  | | | |_) | |/ ____ \| |    _| |_                                                                                                    
                                                                                                   |_|  |_|_|_.__/|_/_/    \_\_|   |_____|                                                                                                   

                                                                               A program that implements easy-to-use APIs for a variety of commonly used sites                                                                               
                                                                                                Repository: https://github.com/mixmoe/HibiAPI                                                                                                

2022-05-30 13:59:48.240 | INFO     | hibiapi.__main__:main:82 - HibiAPI version: 0.7.7
2022-05-30 13:59:48.243 | INFO     | hibiapi.__main__:main:83 - Server is running under production mode!
2022-05-30 13:59:48.244 | WARNING  | uvicorn.config:__init__:298 - Current configuration will not reload as not all conditions are met,please refer to documentation.
2022-05-30 13:59:48.774 | WARNING  | hibiapi.app.routes.pixiv:<module>:23 - Pixiv API token is not set, pixiv endpoint will be unavailable.
2022-05-30 13:59:48.815 | WARNING  | hibiapi.app.routes.sauce:<module>:17 - Sauce API key not set, SauceNAO endpoint will be unavailable
2022-05-30 13:59:48.915 | WARNING  | hibiapi.app.routes:<module>:37 - API Route /pixiv has been disabled in config.
2022-05-30 13:59:48.921 | WARNING  | hibiapi.app.routes:<module>:37 - API Route /sauce has been disabled in config.
2022-05-30 13:59:49.006 | INFO     | sentry_sdk.integrations.logging:sentry_patched_callhandlers:86 - Started server process [7146]
2022-05-30 13:59:49.007 | INFO     | sentry_sdk.integrations.logging:sentry_patched_callhandlers:86 - Waiting for application startup.
2022-05-30 13:59:49.010 | INFO     | sentry_sdk.integrations.logging:sentry_patched_callhandlers:86 - Application startup complete.
2022-05-30 13:59:49.013 | INFO     | sentry_sdk.integrations.logging:sentry_patched_callhandlers:86 - Uvicorn running on http://195.170.xxx.xxx:8032 (Press CTRL+C to quit)
2022-05-30 13:59:54.024 | INFO     | sentry_sdk.integrations.logging:sentry_patched_callhandlers:86 - Shutting down
2022-05-30 13:59:54.126 | INFO     | sentry_sdk.integrations.logging:sentry_patched_callhandlers:86 - Waiting for application shutdown.
2022-05-30 13:59:54.134 | INFO     | sentry_sdk.integrations.logging:sentry_patched_callhandlers:86 - Application shutdown complete.
2022-05-30 13:59:54.135 | INFO     | sentry_sdk.integrations.logging:sentry_patched_callhandlers:86 - Finished server process [7146]
2022-05-30 14:01:27.184 | WARNING  | hibiapi.__main__:main:79 -                                                                                                                                                                                                                                        
                                                                                                    _    _ _ _     _          _____ _____                                                                                                    
                                                                                                   | |  | (_) |   (_)   /\   |  __ \_   _|                                                                                                   
                                                                                                   | |__| |_| |__  _   /  \  | |__) || |                                                                                                     
                                                                                                   |  __  | | '_ \| | / /\ \ |  ___/ | |                                                                                                     
                                                                                                   | |  | | | |_) | |/ ____ \| |    _| |_                                                                                                    
                                                                                                   |_|  |_|_|_.__/|_/_/    \_\_|   |_____|                                                                                                   

                                                                               A program that implements easy-to-use APIs for a variety of commonly used sites                                                                               
                                                                                                Repository: https://github.com/mixmoe/HibiAPI                                                                                                

2022-05-30 14:01:27.187 | INFO     | hibiapi.__main__:main:82 - HibiAPI version: 0.7.7
2022-05-30 14:01:27.188 | INFO     | hibiapi.__main__:main:83 - Server is running under production mode!
2022-05-30 14:01:27.189 | WARNING  | uvicorn.config:__init__:298 - Current configuration will not reload as not all conditions are met,please refer to documentation.
2022-05-30 14:01:27.675 | WARNING  | hibiapi.app.routes.sauce:<module>:17 - Sauce API key not set, SauceNAO endpoint will be unavailable
2022-05-30 14:01:27.790 | WARNING  | hibiapi.app.routes:<module>:37 - API Route /sauce has been disabled in config.
2022-05-30 14:01:27.896 | INFO     | sentry_sdk.integrations.logging:sentry_patched_callhandlers:86 - Started server process [8219]
2022-05-30 14:01:27.897 | INFO     | sentry_sdk.integrations.logging:sentry_patched_callhandlers:86 - Waiting for application startup.
2022-05-30 14:01:29.182 | INFO     | hibiapi.api.pixiv.net:user:55 - Pixiv account 74284369 info Updated: SweetCosplay(user_htje2345).
2022-05-30 14:01:29.183 | INFO     | sentry_sdk.integrations.logging:sentry_patched_callhandlers:86 - Application startup complete.
2022-05-30 14:01:29.184 | INFO     | sentry_sdk.integrations.logging:sentry_patched_callhandlers:86 - Uvicorn running on http://195.170.xxx.xxx:8032 (Press CTRL+C to quit)
2022-05-30 14:01:40.083 | INFO     | hibiapi.app.middlewares:request_logger:61 - 60.226.183.93:63667 | GET | 'http://195.170.xxx.xxx:8032/' | 0.998ms | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36 | 302
2022-05-30 14:01:40.398 | INFO     | hibiapi.app.middlewares:request_logger:61 - 60.226.183.93:63667 | GET | 'http://195.170.xxx.xxx:8032/docs' | 0.823ms | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36 | 200
2022-05-30 14:01:41.137 | INFO     | hibiapi.app.middlewares:request_logger:61 - 60.226.183.93:63667 | GET | 'http://195.170.xxx.xxx:8032/openapi.json' | 260.708ms | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36 | 200
2022-05-30 14:01:53.358 | ERROR    | hibiapi.app.handlers:exception_handler:19 - Uncaught exception raised exc.data=ExceptionReturn(url=None, time=datetime.datetime(2022, 5, 30, 14, 1, 53, 357965), code=500, detail='TypeError', headers={}):
Traceback (most recent call last):

  File "/var/www/api.zettai.moe/htdocs/myhibi/bin/hibiapi", line 8, in <module>
    sys.exit(main())
    │   │    └ <Command HibiAPI>
    │   └ <built-in function exit>
    └ <module 'sys' (built-in)>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           │    │     │       └ {}
           │    │     └ ()
           │    └ <function BaseCommand.main at 0x7facad42c550>
           └ <Command HibiAPI>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         │    │      └ <click.core.Context object at 0x7facad671f10>
         │    └ <function Command.invoke at 0x7facad2c29d0>
         └ <Command HibiAPI>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           │   │      │    │           │   └ {'host': '195.170.xxx.xxx', 'port': 8032, 'workers': 1, 'reload': False}
           │   │      │    │           └ <click.core.Context object at 0x7facad671f10>
           │   │      │    └ <function main at 0x7facabd15d30>
           │   │      └ <Command HibiAPI>
           │   └ <function Context.invoke at 0x7facad42cca0>
           └ <click.core.Context object at 0x7facad671f10>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
                       │       └ {'host': '195.170.xxx.xxx', 'port': 8032, 'workers': 1, 'reload': False}
                       └ ()
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/hibiapi/__main__.py", line 87, in main
    uvicorn.run(
    │       └ <function run at 0x7facac905dc0>
    └ <module 'uvicorn' from '/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/uvicorn/__init__.py'>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/uvicorn/main.py", line 463, in run
    server.run()
    │      └ <function Server.run at 0x7facac9058b0>
    └ <uvicorn.server.Server object at 0x7facabd31a90>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/uvicorn/server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
           │       │   │    │             └ None
           │       │   │    └ <function Server.serve at 0x7facac905940>
           │       │   └ <uvicorn.server.Server object at 0x7facabd31a90>
           │       └ <function run at 0x7facad277160>
           └ <module 'asyncio' from '/usr/lib/python3.8/asyncio/__init__.py'>
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
           │    │                  └ <coroutine object Server.serve at 0x7facabd1dcc0>
           │    └ <method 'run_until_complete' of 'uvloop.loop.Loop' objects>
           └ <uvloop.Loop running=True closed=False debug=False>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 372, in run_asgi
    result = await app(self.scope, self.receive, self.send)
                   │   │    │      │    │        │    └ <function RequestResponseCycle.send at 0x7facab4c5940>
                   │   │    │      │    │        └ <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7faca51d9d60>
                   │   │    │      │    └ <function RequestResponseCycle.receive at 0x7facab4c59d0>
                   │   │    │      └ <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7faca51d9d60>
                   │   │    └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('195.170.xxx.xxx', 8032...
                   │   └ <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7faca51d9d60>
                   └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x7facabcce100>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
                 │    │   │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7faca51d9d...
                 │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7faca51...
                 │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('195.170.xxx.xxx', 8032...
                 │    └ <fastapi.applications.FastAPI object at 0x7faca745f1f0>
                 └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x7facabcce100>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/fastapi/applications.py", line 208, in __call__
    await super().__call__(scope, receive, send)
                           │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7faca51d9d...
                           │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7faca51...
                           └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('195.170.xxx.xxx', 8032...
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
          │    │                │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7faca51d9d...
          │    │                │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7faca51...
          │    │                └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('195.170.xxx.xxx', 8032...
          │    └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x7faca72be160>
          └ <fastapi.applications.FastAPI object at 0x7faca745f1f0>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
          │    │   │      │        └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x7faca5201b80>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7faca51...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('195.170.xxx.xxx', 8032...
          │    └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7faca72be100>
          └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x7faca72be160>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/middleware/base.py", line 63, in __call__
    response = await self.dispatch_func(request, call_next)
                     │    │             │        └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7faca5201940>
                     │    │             └ <starlette.requests.Request object at 0x7faca51d9be0>
                     │    └ <function uncaught_exception_handler at 0x7faca72b7af0>
                     └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7faca72be100>
> File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/hibiapi/app/middlewares.py", line 86, in uncaught_exception_handler
    response = await call_next(request)
                     │         └ <starlette.requests.Request object at 0x7faca51d9be0>
                     └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7faca5201940>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/middleware/base.py", line 44, in call_next
    raise app_exc
          └ TypeError('unsupported format string passed to IPv4Address.__format__')
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/middleware/base.py", line 34, in coro
    await self.app(scope, request.receive, send_stream.send)
          │    │   │      │       │        │           └ <function MemoryObjectSendStream.send at 0x7facac7d8790>
          │    │   │      │       │        └ MemoryObjectSendStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=deque([]), open_send_channels=0, open_receive...
          │    │   │      │       └ <property object at 0x7facab10bcc0>
          │    │   │      └ <starlette.requests.Request object at 0x7faca51d9be0>
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('195.170.xxx.xxx', 8032...
          │    └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7faca72be0a0>
          └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7faca72be100>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/middleware/base.py", line 63, in __call__
    response = await self.dispatch_func(request, call_next)
                     │    │             │        └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7faca5201c10>
                     │    │             └ <starlette.requests.Request object at 0x7faca51d9760>
                     │    └ <function contextvar_setter at 0x7faca72b7a60>
                     └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7faca72be0a0>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/hibiapi/app/middlewares.py", line 76, in contextvar_setter
    response = await call_next(request)
                     │         └ <starlette.requests.Request object at 0x7faca51d9760>
                     └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7faca5201c10>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/middleware/base.py", line 44, in call_next
    raise app_exc
          └ TypeError('unsupported format string passed to IPv4Address.__format__')
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/middleware/base.py", line 34, in coro
    await self.app(scope, request.receive, send_stream.send)
          │    │   │      │       │        │           └ <function MemoryObjectSendStream.send at 0x7facac7d8790>
          │    │   │      │       │        └ MemoryObjectSendStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=deque([]), open_send_channels=0, open_receive...
          │    │   │      │       └ <property object at 0x7facab10bcc0>
          │    │   │      └ <starlette.requests.Request object at 0x7faca51d9760>
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('195.170.xxx.xxx', 8032...
          │    └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7faca72be040>
          └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7faca72be0a0>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/middleware/base.py", line 63, in __call__
    response = await self.dispatch_func(request, call_next)
                     │    │             │        └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7faca51c4670>
                     │    │             └ <starlette.requests.Request object at 0x7faca51ca550>
                     │    └ <function request_logger at 0x7faca72b79d0>
                     └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7faca72be040>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/hibiapi/app/middlewares.py", line 45, in request_logger
    response = await call_next(request)
                     │         └ <starlette.requests.Request object at 0x7faca51ca550>
                     └ <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x7faca51c4670>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/middleware/base.py", line 44, in call_next
    raise app_exc
          └ TypeError('unsupported format string passed to IPv4Address.__format__')
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/middleware/base.py", line 34, in coro
    await self.app(scope, request.receive, send_stream.send)
          │    │   │      │       │        │           └ <function MemoryObjectSendStream.send at 0x7facac7d8790>
          │    │   │      │       │        └ MemoryObjectSendStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=deque([]), open_send_channels=0, open_receive...
          │    │   │      │       └ <property object at 0x7facab10bcc0>
          │    │   │      └ <starlette.requests.Request object at 0x7faca51ca550>
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('195.170.xxx.xxx', 8032...
          │    └ <sentry_sdk.integrations.asgi.SentryAsgiMiddleware object at 0x7faca72bc840>
          └ <starlette.middleware.base.BaseHTTPMiddleware object at 0x7faca72be040>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/sentry_sdk/integrations/asgi.py", line 115, in _run_asgi3
    return await self._run_app(scope, lambda: self.app(scope, receive, send))
                 │    │        │              │    │   │      │        └ <bound method MemoryObjectSendStream.send of MemoryObjectSendStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=...
                 │    │        │              │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7faca51...
                 │    │        │              │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('195.170.xxx.xxx', 8032...
                 │    │        │              │    └ <member 'app' of 'SentryAsgiMiddleware' objects>
                 │    │        │              └ <sentry_sdk.integrations.asgi.SentryAsgiMiddleware object at 0x7faca72bc840>
                 │    │        └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('195.170.xxx.xxx', 8032...
                 │    └ <function SentryAsgiMiddleware._run_app at 0x7faca72b7430>
                 └ <sentry_sdk.integrations.asgi.SentryAsgiMiddleware object at 0x7faca72bc840>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/sentry_sdk/integrations/asgi.py", line 162, in _run_app
    raise exc from None
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/sentry_sdk/integrations/asgi.py", line 159, in _run_app
    return await callback()
                 └ <function SentryAsgiMiddleware._run_asgi3.<locals>.<lambda> at 0x7faca51c48b0>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/middleware/trustedhost.py", line 34, in __call__
    await self.app(scope, receive, send)
          │    │   │      │        └ <bound method MemoryObjectSendStream.send of MemoryObjectSendStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=...
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7faca51...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('195.170.xxx.xxx', 8032...
          │    └ <starlette.middleware.cors.CORSMiddleware object at 0x7faca72b0f70>
          └ <starlette.middleware.trustedhost.TrustedHostMiddleware object at 0x7faca72b0fa0>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/middleware/cors.py", line 84, in __call__
    await self.app(scope, receive, send)
          │    │   │      │        └ <bound method MemoryObjectSendStream.send of MemoryObjectSendStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=...
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7faca51...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('195.170.xxx.xxx', 8032...
          │    └ <starlette.middleware.gzip.GZipMiddleware object at 0x7faca72b0f10>
          └ <starlette.middleware.cors.CORSMiddleware object at 0x7faca72b0f70>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/middleware/gzip.py", line 23, in __call__
    await responder(scope, receive, send)
          │         │      │        └ <bound method MemoryObjectSendStream.send of MemoryObjectSendStream(_state=MemoryObjectStreamState(max_buffer_size=0, buffer=...
          │         │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7faca51...
          │         └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('195.170.xxx.xxx', 8032...
          └ <starlette.middleware.gzip.GZipResponder object at 0x7faca51ca460>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/middleware/gzip.py", line 42, in __call__
    await self.app(scope, receive, self.send_with_gzip)
          │    │   │      │        │    └ <function GZipResponder.send_with_gzip at 0x7faca72afe50>
          │    │   │      │        └ <starlette.middleware.gzip.GZipResponder object at 0x7faca51ca460>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7faca51...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('195.170.xxx.xxx', 8032...
          │    └ <starlette.exceptions.ExceptionMiddleware object at 0x7faca72b0790>
          └ <starlette.middleware.gzip.GZipResponder object at 0x7faca51ca460>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
          │    │   │      │        └ <function ExceptionMiddleware.__call__.<locals>.sender at 0x7faca51c4940>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7faca51...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('195.170.xxx.xxx', 8032...
          │    └ <fastapi.routing.APIRouter object at 0x7faca745f250>
          └ <starlette.exceptions.ExceptionMiddleware object at 0x7faca72b0790>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
          │     │      │      │        └ <function ExceptionMiddleware.__call__.<locals>.sender at 0x7faca51c4940>
          │     │      │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7faca51...
          │     │      └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('195.170.xxx.xxx', 8032...
          │     └ <function Route.handle at 0x7facab0e3940>
          └ <fastapi.routing.APIRoute object at 0x7faca7339cd0>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
          │    │   │      │        └ <function ExceptionMiddleware.__call__.<locals>.sender at 0x7faca51c4940>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7faca51...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('195.170.xxx.xxx', 8032...
          │    └ <function request_response.<locals>.app at 0x7faca73ac670>
          └ <fastapi.routing.APIRoute object at 0x7faca7339cd0>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/starlette/routing.py", line 61, in app
    response = await func(request)
                     │    └ <starlette.requests.Request object at 0x7faca51caf10>
                     └ <function get_request_handler.<locals>.app at 0x7faca73ac5e0>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/fastapi/routing.py", line 216, in app
    solved_result = await solve_dependencies(
                          └ <function solve_dependencies at 0x7facab0cbd30>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/fastapi/dependencies/utils.py", line 525, in solve_dependencies
    solved = await call(**sub_values)
                   │      └ {'request': <starlette.requests.Request object at 0x7faca51caf10>}
                   └ <function rate_limit_depend at 0x7faca74693a0>
  File "/var/www/api.zettai.moe/htdocs/myhibi/lib/python3.8/site-packages/hibiapi/app/application.py", line 86, in rate_limit_depend
    limit_key = f"rate_limit:IPv{client_ip.version}-{client_ip:x}"

TypeError: unsupported format string passed to IPv4Address.__format__
2022-05-30 14:01:53.826 | INFO     | hibiapi.app.middlewares:request_logger:61 - 60.226.183.93:63669 | GET | 'http://195.170.xxx.xxx:8032/favicon.ico' | 1.261ms | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36 | 404

Running on Ubuntu 20.04 LTS

mnixry commented 2 years ago

Thank you for your feedback.

It is a known issue, but I currently have no time to fix it 😢. You can try to disable the rate limit option as a temporary workaround now.

https://github.com/mixmoe/HibiAPI/blob/2a569e6b4188484685c425c3e5a1af4b0792720f/hibiapi/configs/general.yml#L37-L40

Or, I guess upgrading Python to 3.10 may fix this issue. (Because my production and development environment is Python 3.10, and I don't meet this error)

Please leave this issue open until I fixed it.


By the way, if you are willing, can you provide some contact method, I want to communicate further with you XD

Ruriko commented 2 years ago

Upgrading python to 3.10 fixed the problem. You can contact me on skype: live:shaorin