Created
March 6, 2021 17:39
-
-
Save Tarequzzaman/bf9b7436b0566a6148904353aaf1f30b to your computer and use it in GitHub Desktop.
async post request python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import aiohttp | |
async def call_url(session): | |
url = "http://127.0.0.1:5005/webhooks/rest/webhook" | |
data = '{"sender":"218311","message":"english"}' | |
response = await session.post(url=url, data=data) | |
return response | |
# async def call_with_aiohttp(): | |
async with aiohttp.ClientSession() as session: | |
x = await call_url(session) | |
if x.status == 200: | |
y= await x.json() | |
print(y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment