inspire_mitmproxy.services package

INSPIRE-MITMProxy Fake Services.

Submodules

inspire_mitmproxy.services.arxiv_service module

Fake Service for Arxiv.

class inspire_mitmproxy.services.arxiv_service.ArxivService

Bases: inspire_mitmproxy.services.base_service.BaseService

SERVICE_HOSTS = ['arxiv.org', 'export.arxiv.org']

inspire_mitmproxy.services.base_service module

Base for fake services.

class inspire_mitmproxy.services.base_service.BaseService

Bases: object

Mocked service base.

SERVICE_HOSTS = []
get_interactions_for_active_scenario() → List[inspire_mitmproxy.interaction.Interaction]

Get a list of scenarios

get_interactions_in_scenario(scenario_path: pathlib.Path) → List[inspire_mitmproxy.interaction.Interaction]
get_path_for_active_scenario_dir(create=False) → pathlib.Path
handles_request(request: inspire_mitmproxy.http.MITMRequest) → bool

Can this service handle the request?

increment_interaction_count(interaction_name: str)
name
process_request(request)
process_response(request: inspire_mitmproxy.http.MITMRequest, response: inspire_mitmproxy.http.MITMResponse)

Perform operations based on live response.

set_active_scenario(active_scenario: str)

inspire_mitmproxy.services.legacy_service module

Fake Service for Arxiv.

class inspire_mitmproxy.services.legacy_service.LegacyService

Bases: inspire_mitmproxy.services.base_service.BaseService

SERVICE_HOSTS = ['inspirehep.net']

inspire_mitmproxy.services.management_service module

Service used to orchestrate fake services.

class inspire_mitmproxy.services.management_service.ManagementService(services: List[inspire_mitmproxy.services.base_service.BaseService]) → None

Bases: inspire_mitmproxy.services.base_service.BaseService

INTERACTIONS_ENDPOINT = re.compile('/service/(\\w+)/interactions')
SERVICE_HOSTS = ['mitm-manager.local']
build_response(code: int, json_message: Union[dict, list, NoneType]) → inspire_mitmproxy.http.MITMResponse
get_active_scenario()
get_config() → dict
get_scenarios() → dict
get_service_interactions(service_name) → dict
get_services() → dict
post_config(request: inspire_mitmproxy.http.MITMRequest)
process_request(request: inspire_mitmproxy.http.MITMRequest) → inspire_mitmproxy.http.MITMResponse
propagate_option_changes()

On change of config, propagate relevant information to services.

put_config(request: inspire_mitmproxy.http.MITMRequest)
set_recording(request: inspire_mitmproxy.http.MITMRequest)

inspire_mitmproxy.services.rt_service module

Fake Service for RT Ticketing System.

class inspire_mitmproxy.services.rt_service.RTService

Bases: inspire_mitmproxy.services.base_service.BaseService

SERVICE_HOSTS = ['inspirevm13.cern.ch', 'rt.inspirehep.net']

inspire_mitmproxy.services.whitelist_service module

Service which allows all requests outside

class inspire_mitmproxy.services.whitelist_service.WhitelistService(*args, **kwargs)

Bases: inspire_mitmproxy.services.base_service.BaseService

DEFAULT_HOSTS = 'test-indexer test-scrapyd test-web-e2e.local'
process_request(request: inspire_mitmproxy.http.MITMRequest)
process_response(request: inspire_mitmproxy.http.MITMRequest, response: inspire_mitmproxy.http.MITMResponse)

Perform operations based on live response.