Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Httpx, but made easy

The easiest way to interact with the httpx library, including Sync and Async clients.

Functionality

Simplify the way we have to interact with external urls and make requests (POST, GET, etc.).

Usage

Using this library is as simple and intuitive as doing this:

# Create an Async instance within this context
async with AsyncHttpClient() as http_client:
    # Make a no-stream GET request
    response = await http_client.get.complete(
        url = url
    )

# Create a Sync instance within this context
with HttpClient() as http_client:
    # Make a no-stream GET request
    response = http_client.get.complete(
        url = url
    )

or this:

# Create an Async client instance within a context
async with HttpClient() as http_client:
    # Make a stream GET request
    async with await http_client.get.stream(
        url = url
    ) as response:
        # Do whatever you need with the response
        chunks_count = 0
        bytes = b""
        # Iterate over the bytes asynchronously
        async for chunk in response.aiter_bytes(
            chunk_size = chunk_size
        ):
            bytes += chunk
            chunks_count += 1

The resources are closed and freed once you are done. Easy.

She the tests to know more about how to use it.

About

Make httpx easier

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages