Method Documentation
The main SDK object by which all other methods are accessed is created by
calling py42.sdk.from_local_account
or py42.sdk.from_jwt_provider
. For example:
import py42.sdk
sdk = py42.sdk.from_local_account("console.us.code42.com", "john.doe@example.com", "my_pw")
# access properties on 'sdk' to explore all the available methods
Important
py42 only supports token-based authentication.
Explore the complete public documentation for py42
below.
- py42.sdk.from_jwt_provider(host_address, jwt_provider)
Creates a
SDKClient
object for accessing the Code42 REST APIs using a custom auth mechanism. User can use any authentication mechanism like that returns a JSON Web token on authentication which would then be used for all subsequent requests.- Parameters
host_address (str) – The domain name of the Code42 instance being authenticated to, e.g. console.us.code42.com
jwt_provider (function) – A function that accepts no parameters and on execution returns a JSON web token string.
- Returns
- py42.sdk.from_local_account(host_address, username, password, totp=None)
Creates a
SDKClient
object for accessing the Code42 REST APIs using the supplied credentials. This method supports only accounts created within the Code42 console or using the APIs (including py42). Username/passwords that are based on Active Directory, Okta, or other Identity providers cannot be used with this method.- Parameters
host_address (str) – The domain name of the Code42 instance being authenticated to, e.g. console.us.code42.com
username (str) – The username of the authenticating account.
password (str) – The password of the authenticating account.
totp (callable or str, optional) – The time-based one-time password of the authenticating account. Include only if the account uses Code42’s two-factor authentication. Defaults to None.
- Returns
- class py42.sdk.SDKClient(main_connection, auth)
Bases:
object
- property alerts
A collection of methods related to retrieving and updating alerts rules.
- property archive
A collection of methods for accessing Code42 storage archives. Useful for doing web-restores or finding a file on an archive.
- property auditlogs
A collection of methods for retrieving audit logs.
- property cases
A collection of methods and properties for managing cases and file events associated with the case.
- Returns
py42.clients.cases.CaseClient
- property detectionlists
A collection of properties each containing methods for managing specific detection lists, such as departing employees.
- property devices
A collection of methods for retrieving or updating data about devices in the Code42 environment.
- classmethod from_jwt_provider(host_address, jwt_provider)
- Creates a
SDKClient
object for accessing the Code42 REST APIs using a custom auth mechanism. User can use any authentication mechanism like that returns a JSON Web token on authentication which would then be used for all subsequent requests.
- Parameters
host_address (str) – The domain name of the Code42 instance being authenticated to, e.g. console.us.code42.com
jwt_provider (function) – A function that accepts no parameters and on execution returns a
string. (JSON web token) –
- Returns
- Creates a
- classmethod from_local_account(host_address, username, password, totp=None)
Creates a
SDKClient
object for accessing the Code42 REST APIs using the supplied credentials. This method supports only accounts created within the Code42 console or using the APIs (including py42). Username/passwords that are based on Active Directory, Okta, or other Identity providers should use the from_jwt_provider method.- Parameters
host_address (str) – The domain name of the Code42 instance being authenticated to, e.g. console.us.code42.com
username (str) – The username of the authenticating account.
password (str) – The password of the authenticating account.
totp (callable or str, optional) – The time-based one-time password of the authenticating account. Include only if the account uses Code42’s two-factor authentication. Defaults to None.
- Returns
- property legalhold
A collection of methods for retrieving and updating legal-hold matters, policies, and custodians.
- property loginconfig
A collection of methods related to getting information about the login configuration of user accounts.
- Returns
py42.clients.loginconfig.LoginConfigurationClient.
- property orgs
A collection of methods for retrieving or updating data about organizations in the Code42 environment.
- Returns
- property securitydata
- A collection of methods and properties for getting security data such as:
File events
Security plan information
- property serveradmin
A collection of methods for getting server information for on-premise environments and tenant information for cloud environments.
- Returns
py42.services.administration.AdministrationService
- property trustedactivities
A collection of methods and properties for managing trusted domains.
- property usercontext
A collection of methods related to getting information about the currently logged in user, such as the tenant ID.
- Returns
- property userriskprofile
A collection of methods and properties for managing user risk profiles.
- property users
A collection of methods for retrieving or updating data about users in the Code42 environment.
- Returns
- property watchlists
A collection of methods and properties for managing watchlists.