Skip to main content

smithy-http

This package provides primitives and interfaces for http functionality in tooling generated by Smithy.


Testing

The smithy_http.testing module provides shared utilities for testing HTTP functionality in smithy-python clients.

MockHTTPClient

The MockHTTPClient allows you to test smithy-python clients without making actual network calls. It implements the HTTPClient interface and provides configurable responses for functional testing.

Basic Usage

from smithy_http.testing import MockHTTPClient

# Create mock client and configure responses
mock_client = MockHTTPClient()
mock_client.add_response(
   status=200,
   headers=[("Content-Type", "application/json")],
   body=b'{"message": "success"}'
)

# Use with your smithy-python client
config = Config(transport=mock_client)
client = TestSmithyServiceClient(config=config)

# Test your client logic
result = await client.some_operation({"input": "data"})

# Inspect what requests were made
assert mock_client.call_count == 1
captured_request = mock_client.captured_requests[0]
assert result.message == "success"

Utilities

  • create_test_request(): Helper for creating test HTTPRequest objects
  • MockHTTPClientError: Exception raised when no responses are queued

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smithy_http-0.4.4.tar.gz (30.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smithy_http-0.4.4-py3-none-any.whl (41.7 kB view details)

Uploaded Python 3

File details

Details for the file smithy_http-0.4.4.tar.gz.

File metadata

  • Download URL: smithy_http-0.4.4.tar.gz
  • Upload date:
  • Size: 30.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Amazon Linux","version":"2023","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for smithy_http-0.4.4.tar.gz
Algorithm Hash digest
SHA256 b347abbf1133f88c292dab78210644a4152e8b98d75d986131705e6dc0eb8840
MD5 f63d9e940cf0d80bcdc1b7f83a997416
BLAKE2b-256 e4cb53bfa13998fd568fafd5e306485e2fb934e3be5626b114c59a48462f5390

See more details on using hashes here.

File details

Details for the file smithy_http-0.4.4-py3-none-any.whl.

File metadata

  • Download URL: smithy_http-0.4.4-py3-none-any.whl
  • Upload date:
  • Size: 41.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Amazon Linux","version":"2023","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for smithy_http-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fa65dc28847b18aa86d45336b45ba86005a99675f73305638c2854d7bdaa0974
MD5 cef1f8eea57bc0fb0535498cd5069684
BLAKE2b-256 645b88270f68f935e177c35da8d6e40bd866f416f53bfb845e2652ca669c81bf

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 Sentry Error logging StatusPage Status page