Postman SDK
Project description
About
This SDK instruments python web frameworks to capture http requests for auto-generating accurate postman live collections.
The minimum supported version for Python is: 3.7+.
Installation Process
pip install postman-sdk
Initializing the SDK
At the top of your app.py file, before app is initialized, add this.
import postman_sdk as pm
pm.initialize(
{
"api_key": "POSTMAN_API_KEY",
"collection_id": "LIVE_COLLECTION_ID",
"debug": True/False,
}
)
Configuration
For initialization the SDK, the following values can be configured -
-
collection_id: Postman collectionId where requests will be added. This is the id for your live collection.
- Type:
string
- Type:
-
api_key: Postman api key needed for authentication.
- Type:
string
- Type:
-
debug: Enable/Disable debug logs.
- Type:
boolean
- Default:
False
- Type:
-
enable: Enable/Disable the SDK. Disabled SDK does not capture any new traces, nor does it use up system resources.
- Type:
boolean
- Default:
True
- Type:
-
truncate_data: Truncate the request and response body so that no PII data is sent to Postman. This is enabled by default. Disabling it sends actual request and response payloads.
-
Example:
Sample payload or non-truncated payload:
{ "first_name": "John", "age": 30 }
Truncated payload:
{ "first_name": { "type": "str" }, "age": { "type": "int" } }
-
Type:
boolean
-
Default:
True
-
-
redact_sensitive_data: Redact sensitive data such as api_keys and auth tokens, before they leave the sdk. This is enabled by default. But NO rules are set.
- Example:
{ "redact_sensitive_data": { "enable": True(default), "rules": { "<rule name>": "<regex to match the rule>", # such as - "basic_auth": r"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b", }, } }
- Type:
object
- Example:
-
ignore_incoming_requests: List of regexes to be ignored from instrumentation. This rule only applies to endpoints that are served by the application/server.
- Example:
{ "ignore_incoming_requests": ["knockknock", "^get.*"] }
The above example, will ignore any endpoint that contains the word "knockknock" in it, and all endpoints that start with get, and contain any characters after that. - Type:
dict
- Example:
-
ignore_outgoing_requests: List of regexes to be ignored from instrumentation. This rule only applies to endpoints that are called by the application/server.
- Example:
{ "ignore_outgoing_requests": ["knockknock", "^get.*"] }
The above example, will ignore any endpoint that contains the word "knockknock" in it, and all endpoints that start with get, and contain any characters after that. - Type:
dict
- Example:
-
buffer_interval_in_milliseconds: The interval in milliseconds that the SDK waits before sending data to Postman. The default interval is 5000 milliseconds. This interval can be tweaked for lower or higher throughput systems.
- Type:
int
- Default:
5000
- Type:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for postman_sdk-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e682072b6e5000f5efec6eda0e35d0d1ba0b335e8d4220e6a4c5b78ee5f4f51b |
|
MD5 | 846ea7fccc9fe1138654c21d4875f747 |
|
BLAKE2b-256 | 1e18ae85364327b4bd52caa2fb8ca63bd1067e552b45438c7a115116d84fa74e |