Skip to main content

An HTTP asynchronous client.

Project description

HTTPlus

An HTTP asynchronous client.

Stable Version

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.1.tar.gz (4.1 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.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for httplus-0.1.1.tar.gz
Algorithm Hash digest
SHA256 55946240c8c1ca63a235bfd8fa0c104e02c5abe917b872c480ea8f9b795b1466
MD5 a8912bfe46a616705bec0d79ed368dbc
BLAKE2b-256 1d918d092cb8dfbd9b8db8c7955b6a1c2004e1d4cd8e071d216f56e5387e22ab

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for httplus-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 474cfe2fed5b053cca8d1c67c2ce9de928953837a129fb769816152927b18179
MD5 64885d8aa24005a20a81095c7387093f
BLAKE2b-256 42023deb1762b231a6e3cec1112a7f27c3af34cad4006180f8872fef1fa69d2e

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