Skip to main content

HTTP components for Smithy tooling.

Project description

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

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

smithy_http-0.4.1.tar.gz (29.3 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.1-py3-none-any.whl (40.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smithy_http-0.4.1.tar.gz
  • Upload date:
  • Size: 29.3 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.1.tar.gz
Algorithm Hash digest
SHA256 f8a9ec156ac07ab9ced844de798ba8b8853ffe171c657908ffa61124384c087a
MD5 7718d26c9a0f83cb512f6295ee6b3017
BLAKE2b-256 f6187ebcea9ac9af3b5ca0af34747562c9f29d61bcd89e923dfffe6fc890e92e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smithy_http-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 40.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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fee2097521bf668ea1b2757e910c4029d842cc1b533c828d5429859e8e1cd854
MD5 14883ab5ba2622d17bc2dbe118f93a14
BLAKE2b-256 1324e5771159ae4ac97556ff1f4a4647a3460f1419db0779357661f7cd4a3d48

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