traffic_guardian package

Submodules

traffic_guardian.traffic_guardian_client module

class traffic_guardian.traffic_guardian_client.ProxyRule(rule_uri_regex: str, rule_http_method: str, mocked_status_code: int, mocked_json_body: Optional[dict] = None)[source]

Bases: object

get_json()[source]
traffic_guardian.traffic_guardian_client.add_rule(rule: ProxyRule) str[source]

Function used to create new rules to the proxy server as an input it takes instance of a ProxyRule class and on output it returns unique identifier of created rule :param rule: :return: unique identifier of created rule as str

traffic_guardian.traffic_guardian_client.get_last_request_intercepted_by_proxy_rule(rule_id)[source]
Function that returns URI and headers of last intercepted request by the rule

of which identifier is passed as a parameter

Parameters

rule_id

Returns

{

“uri”: “http:example.uri/param=123?, “headers”: {

”Content-Type”: “application/json

}

}

traffic_guardian.traffic_guardian_client.parametrized(dec)[source]
traffic_guardian.traffic_guardian_client.remove_all_proxy_rules()[source]

Function removes all existing rules

traffic_guardian.traffic_guardian_client.remove_rule(rule_id)[source]

Function that removes the proxy rule added earlier using rule_id as and argument :param rule_id:

traffic_guardian.traffic_guardian_client.set_config(host, port)[source]

This function is to set up the host and port on which traffic_guardian proxy server is run :param host: :param port: :return:

traffic_guardian.traffic_guardian_client.with_proxy_rule(*args, **kwargs)[source]

Module contents