Skip to content

shipany.bot.actions.http_request

shipany.bot.actions.http_request package

Submodules

shipany.bot.actions.http_request.v1 module

class shipany.bot.actions.http_request.v1.HttpMethods

Bases: StrEnum

Enum for HTTP methods.

GET = ‘GET’

POST = ‘POST’

PUT = ‘PUT’

PATCH = ‘PATCH’

DELETE = ‘DELETE’

__new__(value)

pydantic model shipany.bot.actions.http_request.v1.HttpRequest

Bases: BaseModel

Action to send an HTTP request.

Payload samples

Send a GET request to https://example.com with a query string parameter foo=bar:

{
"name": "HttpRequest@1",
"method": "GET",
"url": "https://example.com",
"headers": {
"Content-Type": "application/json"
},
"query_string_parameters": {
"foo": "bar"
}
}

POST request with a JSON body:

{
"name": "HttpRequest@1",
"method": "POST",
"url": "https://example.com",
"headers": {
"Content-Type": "application/json"
},
"body": {
"key": "value"
}
}

POST request with basic auth:

{
"name": "HttpRequest@1",
"method": "POST",
"url": "https://example.com",
"headers": {
"Content-Type": "application/json"
},
"basic_auth": "username:password",
"body": {
"key": "value"
}
}

POST request with captures:

{
"name": "HttpRequest@1",
"method": "POST",
"url": "https://example.com",
"headers": {
"Content-Type": "application/json"
},
"body": {
"key": "value"
},
"captures": {
"foo": "response.status_code"
}
}

Pydantic model parameters

field name : t.Literal[‘HttpRequest@1’] [Required]

Name of the action.

field method : HttpMethods [Required]

HTTP method to use for the request.

field url : HttpUrl [Required]

URL to send the request to

  • Constraints:
    • max_length = 2083
    • allowed_schemes = [‘http’, ‘https’]

field headers : dict[str, str] | None = None

Headers to send with the request.

field query_string_parameters : dict[str, str] | None = None

Query string parameters to send with the request.

field basic_auth : str | None = None

Basic auth credentials to use with the request. Should be in the format ‘username:password ’

field timeout : float | None = None

Timeout for the request in seconds.

  • Constraints:
    • le = 300.0

field body : JsonValue | None = None

Body to send with the request (if applicable)

field captures : dict[str, str] | None = None

Capture values from the response. The key is the name of the capture, and the value is a Jinja template to extract the value from the response. For example, {‘foo’: ‘response.status_code’} would extract the value of response.status_ocde and store it as ‘foo’ variable. Available variables are response.content, response.status_code, response.text, and response.headers. The response.content is decoded as a string. Consider post-processing the value with Jinja filters if necessary. If JSON response is expected, apply JsonPath@1 action after.

Module contents