Skip to main content

An HTTP asynchronous client.

Project description

HTTPlus

An HTTP asynchronous client.

Instalation

pip install httplus

Basic Usage

The simplest request using get method is showed below.

import httplus
...
client = httplus.Client()
res = await client.get('http://someserver/api/collection')
print(res.status)
# 200
data = res.json()
# {...}

A request is executed by Client instance class. The Client class has get, post, put, delete, options, patch and head methods to do requests.

Examples

Sending data through POST request

import httplus
...
data = {
    'name': 'Vink',
    'surname': 'Blaster'
}
client = httplus.Client()
res = await client.post('http://someserver/api/customers', data=data)
print(res.status)
# 200

The data parameter can be a dict, list or a binary object. A dict or a list passed by data param will be interpreted like JSON format data. If a binary data like a pdf or an image file is been sending, a header content mime type need to be informed by headers param.

import httplus
...
image = b'<some_image_binary>'
headers = {
    'Content-Type': 'image/png'
}
url = 'http://someserver/api/books'
...
client = httplus.Client()
res = await client.post(url=url, data=image, headers=headers)
print(res.status)
# 200

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

httplus-0.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

httplus-0.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file httplus-0.1.0.tar.gz.

File metadata

  • Download URL: httplus-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.19.0-41-generic

File hashes

Hashes for httplus-0.1.0.tar.gz
Algorithm Hash digest
SHA256 565c3b7c0d40106b17db6c32a398ddb65bcb1d7236fce365b3e8b0a7d4bbccfa
MD5 3c17a3dad4b0235adb6e4814d2a46598
BLAKE2b-256 06103a8b219c8ac19c48875a529036b53e6a8ad4661f04be21a8171e84a7aca1

See more details on using hashes here.

File details

Details for the file httplus-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: httplus-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.19.0-41-generic

File hashes

Hashes for httplus-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 545371dcdbecd4e05c6007fe22d3ebc28537deeaa90a6f041f4f1782fe97cb4a
MD5 b42b6d287910918b03765bae004e43ea
BLAKE2b-256 4e5363a86d4ff53b21ef586d0a2cd10cc8b20b63f1746b171f55e307aa0882cb

See more details on using hashes here.

Supported by

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