arjuna.interact.http.session module

class arjuna.interact.http.session.HttpSession(*, url=None, oauth_token=None, request_content_handler=None, headers=None, max_redirects=None, auth=None, proxy=None, _auto_session=True)

Bases: object

Create an HTTP Session. Does automatic cookie management.

Keyword Arguments
  • url – Base URL for this HTTP session. If relative path is used as a route in sender methods like .get, then this URL is prefixed to their provided routes.

  • oauth_token – OAuth 2.0 Bearer token for this session.

  • request_content_handler – Default content type handler for requests sent in this session. Overridable in individual sender methods. Default is Http.content.urlencoded.

  • headers – HTTP headers to be added to request headers made by this session.

  • max_redirects – Maximum number of redirects allowed for a request. Default is 30.

  • auth – HTTP Authentication object: Basic/Digest.

  • proxy – Proxies dict to be associated with this session.

add_cookies(cookie_dict)

Add cookies to the session.

property auth

HTTP Authentication object.

property cookies: dict

All current cookie name/values in this session object.

delete(route, label=None, xcodes=None, headers=None, cookies=None, allow_redirects=True, auth=None, timeout: Optional[float] = None, pretty_url=False, query_params=None, **named_query_params) arjuna.tpi.httpauto.response.HttpResponse
get(route, label=None, xcodes=None, headers=None, cookies=None, allow_redirects=True, auth=None, timeout: Optional[float] = None, pretty_url=False, query_params=None, **named_query_params) arjuna.tpi.httpauto.response.HttpResponse
head(route, label=None, xcodes=None, headers=None, cookies=None, allow_redirects=True, auth=None, timeout: Optional[float] = None, pretty_url=False, query_params=None, **named_query_params) arjuna.tpi.httpauto.response.HttpResponse
property headers

Request headers.

options(route, *, label=None, xcodes=None, headers=None, cookies=None, allow_redirects=True, auth=None, timeout: Optional[float] = None, pretty_url=False, query_params=None, **named_query_params) arjuna.tpi.httpauto.response.HttpResponse
property parsed_cookies: dict

All current cookie name and corresponding HttpCookie object in this session object.

patch(route, *, content=<arjuna.tpi.helper.arjtype.NotSet object>, label=None, xcodes=None, headers=None, cookies=None, allow_redirects=True, auth=None, timeout: Optional[float] = None, pretty_url=False, query_params=None, **named_query_params) arjuna.tpi.httpauto.response.HttpResponse
post(route, *, content=<arjuna.tpi.helper.arjtype.NotSet object>, label=None, xcodes=None, headers=None, cookies=None, allow_redirects=True, auth=None, timeout: Optional[float] = None, pretty_url=False, query_params=None, **named_query_params) arjuna.tpi.httpauto.response.HttpResponse
put(route, *, content=<arjuna.tpi.helper.arjtype.NotSet object>, label=None, xcodes=None, headers=None, cookies=None, allow_redirects=True, auth=None, timeout: Optional[float] = None, pretty_url=False, query_params=None, **named_query_params) arjuna.tpi.httpauto.response.HttpResponse
property request_content_handler

Request content handler for content formatting.

property url

Base URL for this session.