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.0b2.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: polywrap_http_plugin-0.1.0b2.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.9 Darwin/22.5.0

File hashes

Hashes for polywrap_http_plugin-0.1.0b2.tar.gz
Algorithm Hash digest
SHA256 d85af8a39bb7a5099496763b79b727e0a08b8383c1bc7a118473b9579fd4d589
MD5 c4349cacb15908a15f396bf1429e1c38
BLAKE2b-256 14f25b738ac8cc654849adac743834b34b6aa3b705a6013d420b099d0b69fa28

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for polywrap_http_plugin-0.1.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 9c1400654a7696e3471e281824606f06d1eb5699072a736f828ad171dc207540
MD5 e7d31a6871889f604f7f2f562d75262d
BLAKE2b-256 b687d179e8f19b63f1ae1e9b4dab3befce5602674e874a20af4b87ab836c9699

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