Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AIOHTTP issue #5

Open
shorecodeorg opened this issue Jul 26, 2024 · 1 comment
Open

AIOHTTP issue #5

shorecodeorg opened this issue Jul 26, 2024 · 1 comment

Comments

@shorecodeorg
Copy link

Occasionally the library will throw an error for the aiohttp not being able to decode the response. I solved this by changing the 'content_type=None' parameter in the get_swap_instructions method:

try:
    async with aiohttp.ClientSession() as session:
        async with session.get(url, params=params) as response:
            data = await response.json(content_type=None)
@shorecodeorg
Copy link
Author

this is what I can get out of the response:

<ClientResponse(https://swap-v2.solanatracker.io/swap?from=So11111111111111111111111111111111111111112&to=67HckfhhE6cZf9iPgpxF1n1XfxCaxq8PTvf4t9dKpump&fromAmount=0.005&slippage=25.0&payer=6KfTkaey3M6sQXvtDzNBjEF8trVBYFP6VERR9Mg8DPem&forceLegacy=true&priorityFee=0.000285) [525 None]>
<CIMultiDictProxy('Date': 'Fri, 26 Jul 2024 16:25:45 GMT', 'Content-Type': 'text/html; charset=UTF-8', 'Content-Length': '6962', 'Connection': 'keep-alive', 'Report-To': '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=9OzNrSRRQab0%2Fs2E54802NlEVS73pD03VMFbivT85vAYE9d4v2FL3jA63OibCSgRnarrnNP54oLRmnexNJBrM%2Bg4II%2BvsbVVfrjGupWLDkWws2MCAHclHtKAJz%2Bbke9JCGlOeiYP3Mc%2FiX3Nh4tKyTXYcZhXnA%3D%3D"}],"group":"cf-nel","max_age":604800}', 'NEL': '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}', 'X-Frame-Options': 'SAMEORIGIN', 'Referrer-Policy': 'same-origin', 'Cache-Control': 'private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0', 'Expires': 'Thu, 01 Jan 1970 00:00:01 GMT', 'Server': 'cloudflare', 'CF-RAY': '8a95bf571cba81b4-SIN')>

Error fetching swap instructions: Expecting value: line 1 column 1 (char 0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant