Skip to main content

HTTPX Client for ThriftPy2

Project description

This package is provides an alternative HTTP client for ThriftPy2 which uses HTTPX instead of the builtin http.client and http.server libraries. This allows the developer to use more complex features like authentication, fine grained timeouts, and asyncio.


Setup (Borrowed from ThriftPy2 Docs):

# pingpong.thrift
service PingPong {
    string ping(),
import thriftpy2
from thriftpy2.http import make_server

pingpong_thrift = thriftpy2.load(

class Dispatcher(object):
    def ping(self):
        return "pong"

server = make_server(

Async Usage:

from thriftpy2_httpx_client import make_aio_client

client = await make_aio_client(pingpong_thrift, url='http://localhost:6000')
print(await  # prints 'pong'

Sync Usage:

from thriftpy2_httpx_client import make_sync_client

client = make_sync_client(pingpong_thrift, url='http://localhost:6000')
print(  # prints 'pong'

Additional keyword arguments can be passed to the client to configure the internal httpx.AsyncClient() and httpx.Client() instances. For example, you can enable Kerberos authentication using httpx-gssapi:

from httpx_gssapi import HTTPSPNEGOAuth
from thriftpy2_httpx_client import make_aio_client

client = await make_aio_client(
print(await  # prints 'pong'

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for thriftpy2-httpx-client, version 0.2.3.post1
Filename, size File type Python version Upload date Hashes
Filename, size thriftpy2_httpx_client-0.2.3.post1-py3-none-any.whl (9.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size thriftpy2-httpx-client-0.2.3.post1.tar.gz (24.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page