Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

httplus

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

httplus

An HTTP asynchronous client.

  • 0.1.2
  • PyPI
  • Socket score

Maintainers
1

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc