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.3.1.tar.gz (28.8 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.3.1-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smithy_http-0.3.1.tar.gz
  • Upload date:
  • Size: 28.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.12

File hashes

Hashes for smithy_http-0.3.1.tar.gz
Algorithm Hash digest
SHA256 2a3faf27146e1a02bdab798dd6b1c57432918a483927ca87c3b8141e206107e9
MD5 04408efb5b7fcec4a9e6c5cf4ba90f1d
BLAKE2b-256 88bc2e7f293932b08a3f546ebd7c1d9ab840c50cb0f9c95c7bc5d1c6cdf1a948

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for smithy_http-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 32f9dac12a3e0d548a0978f660ab470228468b7d6c0576f8cdee9e1aaa247af1
MD5 10cafe4c83edf1fcfe33140b6fe0670f
BLAKE2b-256 eeaca83c919082c72958ac4ba235b57abab0cf6f6e64d9d4ee4d6fbc8b00c718

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