This package contains the HTTP plugin.
Http plugin currently supports two different methods GET and POST. Similar to calling axios, when defining request you need to specify a response type. Headers and query parameters may also be defined.
Response Types
TEXT - The server will respond with text, the HTTP plugin will return the text as-is.
BINARY - The server will respond with binary data (_bytes_), the HTTP plugin will encode as a base64 string and return it.
Quickstart
Imports
>>> import json >>> from polywrap_core import Uri >>> from polywrap_client import PolywrapClient >>> from polywrap_client_config_builder import PolywrapClientConfigBuilder >>> from polywrap_http_plugin import http_plugin >>> from polywrap_msgpack import GenericMap
Create a Polywrap client
>>> http_interface_uri = Uri.from_str("wrapscan.io/polywrap/http@1.0")
>>> http_plugin_uri = Uri.from_str("plugin/http")
>>> config = (
... PolywrapClientConfigBuilder()
... .set_package(http_plugin_uri, http_plugin())
... .add_interface_implementations(http_interface_uri, [http_plugin_uri])
... .set_redirect(http_interface_uri, http_plugin_uri)
... .build()
... )
>>> client = PolywrapClient(config)
Make a GET request
>>> result = client.invoke(
... uri=http_interface_uri,
... method="get",
... args={
... "url": "https://jsonplaceholder.typicode.com/posts",
... "request": {
... "responseType": "TEXT",
... "urlParams": GenericMap({"id": 1}),
... "headers": GenericMap({"X-Request-Header": "req-foo"}),
... },
... }
... )
>>> result.get("status")
200
Make a POST request
>>> result = client.invoke(
... uri=http_interface_uri,
... method="post",
... args={
... "url": "https://jsonplaceholder.typicode.com/posts",
... "request": {
... "responseType": "TEXT",
... "body": json.dumps({
... "userId": 11,
... "id": 101,
... "title": "foo",
... "body": "bar"
... }),
... "headers": GenericMap({"X-Request-Header": "req-foo"}),
... },
... }
... )
>>> result.get("status")
201
Metadata
Release files for polywrap-http-plugin 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| polywrap_http_plugin-0.1.2.tar.gz | 7.6 kB | Without provenance | Details for polywrap_http_plugin-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| polywrap_http_plugin-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for polywrap_http_plugin-0.1.2-py3-none-any.whl |
Total release size: 14.9 kB
Release files / polywrap_http_plugin-0.1.2.tar.gz
| Download URL | polywrap_http_plugin-0.1.2.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50502b79fcf6a75f0d580ec572dc77b42bdb65c8f9b7e650993274268c6c32c3
|
|
BLAKE2b-256 checksum How to use checksums |
c0541d10a0d4a32f3fef3d91ba420f4cfae942c145350b303e2bad7b8c9e2294
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.10.13 Linux/5.15.0-1041-azure
|
Release files / polywrap_http_plugin-0.1.2-py3-none-any.whl
| Download URL | polywrap_http_plugin-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8692ad1978d44703af5e5bb512445b61a8e0c71db60f0eec2241287e4dd6ed50
|
|
BLAKE2b-256 checksum How to use checksums |
a6b4c941be6cc432e98f72684dd4400191d1e69a7c883ea57a110b326b18d3ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.10.13 Linux/5.15.0-1041-azure
|
Security for polywrap-http-plugin 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.