8000 GitHub - gtors/httpj: A fork of httpx with custom JSON serializer support · GitHub
[go: up one dir, main page]

Skip to content
gtorsPublic
forked from encode/httpx

About

A fork of httpx with custom JSON serializer support

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

 
 

Latest commit

 

History

1,512 Commits

Folders and files

Repository files navigation

HTTPJ

HTTPJ HTTPX fork with custom JSON serializer support.

Test Suite Package version

  • HTTPJ is nearly identical to HTTPX. The main difference lies in two extra parameters, json_serialize and json_deserialize, which afford you precise control over the serialization and deserialization of your objects in JSON format.
  • HTTPJ will remain synchronized with the mainstream HTTPX until similar functionality emerges.

Install HTTPJ using pip:

pip install httpj

Now, let's get started:

import datetime
import pprint

import httpj
import orjson


resp = httpj.post(
    "https://postman-echo.com/post",
    json={"dt": datetime.datetime.utcnow()},
    json_serialize=lambda j: orjson.dumps(j, option=orjson.OPT_NAIVE_UTC),  # optional
    json_deserialize=orjson.loads,  # optional
)
pprint.pprint(resp.json(), indent=4)

About

A fork of httpx with custom JSON serializer support

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0