File: json_post.py

package info (click to toggle)
python-treq 25.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 596 kB
  • sloc: python: 4,832; makefile: 130
file content (17 lines) | stat: -rw-r--r-- 287 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from pprint import pprint

from twisted.internet.task import react

import treq


async def json_post(reactor):
    response = await treq.post(
        "https://httpbin.org/post",
        json={"msg": "Hello!"},
    )
    data = await response.json()
    pprint(data)


react(json_post)