Skip to content

Client

class incydr.Client(url=None, api_client_id=None, api_client_secret=None, skip_auth=False, **settings_kwargs)

An HTTP client for interacting with the Code42 Incydr API.

Parameters:

  • url: str The url of your Incydr API gateway. See the developer getting started guide to find your API domain based on your console login URL.
  • api_client_id: str The ID of your Incydr API Client
  • api_client_secret: str The Secret for your Incydr API Client.

Usage example:

>>> import incydr
>>> client = incydr.Client(url="https://api.us.code42.com", api_client_id="<client_id>", api_client_secret="<client_secret>")
settings

Property returning an IncydrSettings object that contains the configuration for this client.

session

Property returning the core requests.Session used to make all HTTP requests.

Contains a hook that prepends the base url of the Code42 API gateway to each request url.

Usage:

>>> response = client.session.get("/v1/users")
>>> response
<Response [200]>
>>> response.url
'https://api.us.code42.com/v1/users'
request_history

Property returning a list of the last n number of requests.Response objects received, where n equals the client.settings.max_response_history value (default=5).

The most recent request is the first item in the list: client.request_history[0]

cases

Property returning a CasesClient for interacting with /v*/cases API endpoints.

Usage:

>>> client.cases.v1.create(name="Test", description="My Description")
customer

Property returning a CustomerClient for interacting with /v*/customer API endpoints.

Usage:

>>> client.customer.v1.get()
departments

Property returning a DepartmentsClient for interacting with /v*/departments API endpoints. Usage:

>>> client.departments.v1.get_page()
devices

Property returning a DevicesClient for interacting with /v*/devices API endpoints. Usage:

>>> client.devices.v1.get_page(active=True)
file_events

Property returning a FileEventsClient for interacting with /v*/file-events API endpoints. Usage:

>>> from incydr import EventQuery
>>> query = EventQuery(start_date='P30D').equals('file.category', 'Document')

>>> client.file_events.v2.search(query)
directory_groups

Property returning a DirectoryGroupsClient for interacting with /v*/directory-groups API endpoints. Usage:

>>> client.directory_groups.v1.get_page()
file_events

Property returning a FileEventsClient for interacting with /v*/file-events API endpoints. Usage:

>>> from incydr import EventQuery
>>> query = EventQuery(start_date='P30D').equals('file.category', 'Document')

>>> client.file_events.v2.search(query)
users

Property returning a UsersClient for interacting with /v*/users API endpoints. Usage:

>>> client.users.v1.get_page(active=True)
user_risk_profiles

Property returning a UserRiskProfilesClient for interacting with /v*/user_risk_profiles API endpoints.

Usage:

>>> client.user_risk_profiles.v1.get_user_risk_profile("23")
watchlists

Property returning a WatchlistsClient for interacting with /v*/watchlists API endpoints. Usage:

>>> client.watchlists.v1.get_page()