Skip to content

Unable to use a proxy #139

@Ad101DP

Description

@Ad101DP

Hello,

I’m encountering an issue when trying to use proxies (both HTTP and SOCKS5) with Shazamio. I'm using Python 3.12, and despite attempting to configure both types of proxies, I’m facing errors.

1. SOCKS5 Proxy Issue:

When using a SOCKS5 proxy, it doesn't seem to be supported natively, and I’m unable to route requests through it.

2. HTTP Proxy Issue:

For HTTP proxies, I’ve configured an HTTP proxy, but when I use it, I get the following warning and error:

env/lib/python3.12/site-packages/aiohttp/connector.py:1048: RuntimeWarning: An HTTPS request is being sent through an HTTPS proxy. This support for TLS in TLS is known to be disabled in the stdlib asyncio (Python <3.11). This is why you'll probably see an error in the log below.

It is possible to enable it via monkeypatching. For more details, see:
* https://bugs.python.org/issue37179
* https://github.com/python/cpython/pull/28073

You can temporarily patch this as follows:
* https://docs.aiohttp.org/en/stable/client_advanced.html#proxy-support
* https://github.com/aio-libs/aiohttp/discussions/6044

  _, proto = await self._create_proxy_connection(req, traces, timeout)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

I have tried to use both HTTP and SOCKS5 proxies, but they do not seem to work with Shazamio’s current implementation. The warning above regarding the TLS-in-TLS issue in Python (asyncio) seems to be blocking the connection when using an HTTP proxy.

Example code

async def main():
    shazam = Shazam()
    result = await shazam.recognize('audio.ogg', proxy="http://198.199.81.12:8080")
    print(result)

asyncio.get_event_loop().run_until_complete(main())

Environment Details:

  • Python Version: 3.12
  • Operating System: Ubuntu 22.04.5 LTS

Any help or guidance on how to resolve these proxy issues would be greatly appreciated.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions