0

I'm using python's aiohttp basic request module to make requests. My request is base64 encoded string and request body looks like:

body = {'request': 'eyJhYmMiOiJ4eXoifQ=='}

Here is the code for sending request:

response = yield from request(method='POST', url=url, allow_redirects=False, headers=headers, data=body)

The problem here is, this is getting received at the other end as:

{'request': 'eyJhYmMiOiJ4eXoifQ%3D%3D'}

which I believe is the url-encoded version of my request body.

How can I avoid this and send request as it is?

3 Answers 3

4

Use json parameter. An example from documentation:

async with aiohttp.ClientSession() as session:
    async with session.post(url, json={'test': 'object'})
Sign up to request clarification or add additional context in comments.

Comments

0

its sad @Svetlov answer is not selected. He is the Aiohttp core developer

Comments

-1

remove content type from header if you are sending

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.