File size: 538 Bytes
346533a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import asyncio
import json

import httpx


async def main():
    files = [("images", open("avatar.jpg", "rb"))]
    texts = []
    args = {"circle": True}
    data = {"texts": texts, "args": json.dumps(args)}

    url = "http://127.0.0.1:2233/memes/petpet/"
    async with httpx.AsyncClient() as client:
        resp = await client.post(url, files=files, data=data)

    with open("result.gif", "wb") as f:
        f.write(resp.content)


if __name__ == "__main__":
    loop = asyncio.new_event_loop()
    loop.run_until_complete(main())