GoodMem
ReferenceClient SDKsPython SDK

Ping API

Ping API documentation for Python SDK

The default url is https://localhost:8080

MethodHTTP requestDescription
ping_oncePOST /v1/ping:onceRun a single ping probe
ping_streamPOST /v1/ping:streamStream ping probe results

ping_once

PingResult ping_once(ping_once_request)

Run a single ping probe

Runs a single ping probe and returns the probe result.

Example

  • Api Key Authentication (ApiKeyAuth):
import goodmem_client
from goodmem_client.models.ping_once_request import PingOnceRequest
from goodmem_client.models.ping_result import PingResult
from goodmem_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://localhost:8080
# See configuration.py for a list of all supported configuration parameters.
configuration = goodmem_client.Configuration(
    host = "https://localhost:8080"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiKeyAuth
configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKeyAuth'] = 'Bearer'

# Enter a context with an instance of the API client
with goodmem_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = goodmem_client.PingApi(api_client)
    ping_once_request = goodmem_client.PingOnceRequest() # PingOnceRequest | Single ping probe request

    try:
        # Run a single ping probe
        api_response = api_instance.ping_once(ping_once_request)
        print("The response of PingApi->ping_once:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling PingApi->ping_once: %s\n" % e)

Parameters

NameTypeDescriptionNotes
ping_once_requestPingOnceRequestSingle ping probe request

Return type

PingResult

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200Ping probe result-
400Invalid request parameters-
401Unauthorized - invalid or missing API key-
403Forbidden - insufficient permissions-
404Target resource not found-
412Precondition failed - target unavailable-
429Rate limit exceeded-
500Internal server error-

↑ Back to Python SDK

ping_stream

PingEvent ping_stream(ping_stream_request, accept=accept)

Stream ping probe results

Opens a streaming ping session and returns per-probe results plus a terminal summary. Supports SSE (text/event-stream) and NDJSON (application/x-ndjson) formats.

Example

  • Api Key Authentication (ApiKeyAuth):
import goodmem_client
from goodmem_client.models.ping_event import PingEvent
from goodmem_client.models.ping_stream_request import PingStreamRequest
from goodmem_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://localhost:8080
# See configuration.py for a list of all supported configuration parameters.
configuration = goodmem_client.Configuration(
    host = "https://localhost:8080"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiKeyAuth
configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKeyAuth'] = 'Bearer'

# Enter a context with an instance of the API client
with goodmem_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = goodmem_client.PingApi(api_client)
    ping_stream_request = goodmem_client.PingStreamRequest() # PingStreamRequest | Ping stream configuration
    accept = 'application/x-ndjson' # str | Response format: 'text/event-stream' for Server-Sent Events or 'application/x-ndjson' for newline-delimited JSON (optional)

    try:
        # Stream ping probe results
        api_response = api_instance.ping_stream(ping_stream_request, accept=accept)
        print("The response of PingApi->ping_stream:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling PingApi->ping_stream: %s\n" % e)

Parameters

NameTypeDescriptionNotes
ping_stream_requestPingStreamRequestPing stream configuration
acceptstrResponse format: 'text/event-stream' for Server-Sent Events or 'application/x-ndjson' for newline-delimited JSON[optional]

Return type

PingEvent

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/x-ndjson, text/event-stream

HTTP response details

Status codeDescriptionResponse headers
200Streaming ping results (SSE or NDJSON)-
400Invalid request parameters-
401Unauthorized - invalid or missing API key-
403Forbidden - insufficient permissions-
404Target resource not found-
412Precondition failed - target unavailable-
429Rate limit exceeded-
500Internal server error-

↑ Back to Python SDK