steps.api.utils.request

Attributes

AUTHORIZATION_KEY

CONTENT_TYPE_KEY

JSON_HEADER_KEY

FORM_HEADER_KEY

Classes

Request

A user-created Request object.

Module Contents

steps.api.utils.request.AUTHORIZATION_KEY = 'Authorization'[source]
steps.api.utils.request.CONTENT_TYPE_KEY = 'Content-Type'[source]
steps.api.utils.request.JSON_HEADER_KEY = 'application/json'[source]
steps.api.utils.request.FORM_HEADER_KEY = 'application/x-www-form-urlencoded'[source]
class steps.api.utils.request.Request(api=None, timeout: int = 3)[source]

Bases: requests.Request

A user-created Request object.

Used to prepare a PreparedRequest, which is sent to the server.

Parameters:
  • method – HTTP method to use.

  • url – URL to send.

  • headers – dictionary of headers to send.

  • files – dictionary of {filename: fileobject} files to multipart upload.

  • data – the body to attach to the request. If a dictionary or list of tuples [(key, value)] is provided, form-encoding will take place.

  • json – json for the body to attach to the request (if files or data is not specified).

  • params – URL parameters to append to the URL. If a dictionary or list of tuples [(key, value)] is provided, form-encoding will take place.

  • auth – Auth handler or (user, pass) tuple.

  • cookies – dictionary or CookieJar of cookies to attach to this request.

  • hooks – dictionary of callback hooks, for internal usage.

Usage:

>>> import requests
>>> req = requests.Request('GET', 'https://httpbin.org/get')
>>> req.prepare()
<PreparedRequest [GET]>
api: steps.api.utils.api.Api = None[source]
method = ''[source]
headers[source]
params[source]
body[source]
original_path_url = ''[source]
path_parameters[source]
path_url = ''[source]
url = ''[source]
log = True[source]
timeout = 3[source]
expected_status_code = '200'[source]
response = None[source]
set_header(key, value)[source]
set_body(key, value)[source]
set_param(key, value)[source]
set_authorization_header(value)[source]
set_json_content_type()[source]
set_form_content_type()[source]
set_url(path_url: str, path_parameters: dict = {})[source]
set_method(method: str)[source]
send()[source]
get_pretty_request() str[source]
get_pretty_response() str[source]
copy()[source]