Skip to main content

No project description provided

Project description

polywrap-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.

GET request

Below is sample invocation of the GET request with custom request headers and query parameters (urlParams).

result = client.invoke(
    uri="wrap://ens/http.polywrap.eth",
    method="get",
    args={
        "url": "http://www.example.com/api",
        "request": {
            "responseType": "TEXT",
            "urlParams": [{"key": "query", "value": "foo"}],
            "headers": [{"key": "X-Request-Header", "value": "req-foo"}],
        },
    },
)

POST request

Below is sample invocation of the POST request with custom request headers and query parameters (urlParams). It is also possible to set request body as shown below.

response = client.invoke(
    uri="wrap://ens/http.polywrap.eth",
    method="post",
    args={
        "url": "http://www.example.com/api",
        "request": {
            "responseType": "TEXT",
            "urlParams": [{"key": "query", "value": "foo"}],
            "headers": [{"key": "X-Request-Header", "value": "req-foo"}],
            "body": "{data: 'test-request'}",
        }
    }
)

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

polywrap_http_plugin-0.1.0a7.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

polywrap_http_plugin-0.1.0a7-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file polywrap_http_plugin-0.1.0a7.tar.gz.

File metadata

  • Download URL: polywrap_http_plugin-0.1.0a7.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.12 Linux/5.15.0-1040-azure

File hashes

Hashes for polywrap_http_plugin-0.1.0a7.tar.gz
Algorithm Hash digest
SHA256 e9cb2df86e5690c09af4e4cf59d427f924ec3bc48484305a0408c1c8b68cabc5
MD5 e623e8e31dc7c24be811c242d2db6bf4
BLAKE2b-256 557094a37428860667a332c94d3725e67f6aa57b2fc1a07e358fddaceca849ea

See more details on using hashes here.

Provenance

File details

Details for the file polywrap_http_plugin-0.1.0a7-py3-none-any.whl.

File metadata

File hashes

Hashes for polywrap_http_plugin-0.1.0a7-py3-none-any.whl
Algorithm Hash digest
SHA256 251ef69d548f7cb102f85f53454d6d4801151fa7b0b20b1950893674a80a0ff3
MD5 05857f222fd5a9879791dd029accedd6
BLAKE2b-256 51c368315e3f61e008709b211332a95496916b249f68b5aeab68a17947089c5c

See more details on using hashes here.

Provenance

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