Skip to main content

Python HTTP client designed to be simple and async context

Project description

badut

Python HTTP client designed to be simple

A zero-dependency HTTP library designed to be simple and async context.

ContributingDocumentationReport Issues


You may enjoy using requests or httpx for HTTP client, why not try badut ?

Features

Badut is a very lightweight library.
The goal of this lib is covers the common HTTP client needs, and still not complete yet.

  • Zero Dependencies
  • Connection Timeouts
  • JSON Parsing
  • Follow Redirects
  • And more coming soon..

Prerequisites

NOTE: Python 3.7 or above

Installation

pip install badut / pipenv install badut

Or manual clone this repository

Quick example

  • GET request
import asyncio
from badut import Badut

client = Badut(json=True, timeout=5)

async def main():
    res = await client.get("https://api.github.com/users/sinkaroid")
    print(res)
    
asyncio.run(main())
  • POST request
async def posting():
    res = await client.post("https://httpbin.org/anything",
        data={"Title": "Hello Badut", "Name": "adalah sy"})
    print(res)
    
asyncio.run(posting())

Example with authentication

Some API requires additional authentication

import asyncio
from badut import Badut

client = Badut(json=True, timeout=5,
    headers={
        "User-Agent": "Badut/1.0.1",
        "authorization": "Bot YouRNicET0k3nFr0mDisc0rd.XuIwOw.IXcORO2fO5XXSmugSombong",
    },
)

async def fetch_discord():
    res = await client.get("https://discord.com/api/v9/users/456298243618504707")
    print(res)
    
asyncio.run(fetch_discord())

Documentation

The documentation can be found https://sinkaroid.github.io/badut

Pronunciation

See why badut exists..

id_ID/ba·dut/ — pelawak (dalam pertunjukan dan sebagainya);
You created an HTTP module for python, meanwhile requests and httpx is exist and those libs is more powerful

badut

Project details


Download files

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

Source Distribution

badut-1.0.4.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file badut-1.0.4.tar.gz.

File metadata

  • Download URL: badut-1.0.4.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.27.1 setuptools/51.3.3 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.7

File hashes

Hashes for badut-1.0.4.tar.gz
Algorithm Hash digest
SHA256 a18eedceb6f24750ae7cdc9e0a76c376bdaa08771b2a7be6b1fade5948bd7cc2
MD5 0074705f8cf7201f2167b63cc61992c6
BLAKE2b-256 715a0ce3eb446848eda8f3edc0d2730dd4073b544d4f4f71706d6aed8b48c8c2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page