Closed PeterPan123456 closed 9 months ago
@PeterPan123456, You can make a PR adding this functionality and I'll accept it :)
For example, you can throw kwargs outside, because they will eventually reach
async with session.post(url, **kwargs) as resp:
Where aiohttp will substitute proxy="...".
# example.py
proxy = 'http://your_user:your_password@your_proxy_url:your_proxy_port'
out = await shazam.recognize_song("data/dora.ogg", proxy=proxy)
# api.py
async def recognize_song(
self,
data: Union[str, pathlib.Path, bytes, bytearray, AudioSegment],
**request_options,
) -> Dict[str, Any]:
...
...
...
results = await self.send_recognize_request(signature, **request_options)
# api.py
async def send_recognize_request(self, sig: DecodedMessage, **request_options) -> Dict[str, Any]:
...
return await self.request(
"POST",
ShazamUrl.SEARCH_FROM_FILE.format(
language=self.language,
endpoint_country=self.endpoint_country,
uuid_1=str(uuid.uuid4()).upper(),
uuid_2=str(uuid.uuid4()).upper(),
**request_options,
),
headers=self.headers(),
json=data,
)
Hi @dotX12
I wanted to express my gratitude for your prompt response to my query. Your guidance on the proxy issue was clear, but as someone who's still navigating the world of programming, I've found it challenging to implement it correctly. I've tried for several hours and didn't suceed. Your library has been a cornerstone in my project, and I've genuinely enjoyed the experience it offers. Given my struggles with the proxy feature, I wanted to ask if you might consider implementing it directly into the library? I believe it could benefit many others in similar situations as well.
Of course, I understand if other commitments take precedence, but I thought it was worth reaching out.
Thank you once again for your patience and trying to help me out.
Closed, problem fixed in 0.5.0.
I'm having trouble using the library in one of my projects. I'm constantly getting rate limited by Shazam and would like to know if there is a way to use proxies, if support for httpx or something else could be implemented?