Session Module


ThreatConnect Requests Session

class tcex.sessions.tc_session.TcSession(auth: Union[HmacAuth, TokenAuth, TcAuth], base_url: str = None, log_curl: Optional[bool] = False, proxies: Optional[Dict[str, str]] = None, proxies_enabled: Optional[bool] = False, user_agent: Optional[dict] = None, verify: Optional[Union[bool, str]] = True)[source]

Bases: Session

ThreatConnect REST API Requests Session

_log_curl(response: Response)[source]

Log the curl equivalent command.

request(method, url, **kwargs)[source]

Override request method disabling verify on token renewal if disabled on session.

retry(retries=3, backoff_factor=0.3, status_forcelist=(500, 502, 504))[source]

Add retry to Requests Session

url(url: str) str[source]

Return appropriate URL string.

The method allows the session to accept the URL Path or the full URL.