The main DEP API wrapper class
commandment.dep.dep.DEP(consumer_key: str = None, consumer_secret: str = None, access_token: str = None, access_secret: str = None, access_token_expiry: Optional[str] = None, url: str = 'https://mdmenrollment.apple.com')[source]¶account() → Union[None, dict][source]¶Get Account Details
The details are returned in the following dict format:
{
'server_name': 'MDM Server Name entered in the portal',
'server_uuid': '<32 char UUID without separators>',
'facilitator_id': 'E-mail of facilitator',
'admin_id': 'Administrator E-mail Address',
'org_name': 'Organization Name',
'org_email': 'Organization E-mail',
'org_phone': 'Organization Contact Phone',
'org_address': 'Organization Physical Address'
}
| Returns: | The account information, or None if it failed. |
|---|---|
| Return type: | Union[None, dict] |
activation_lock(serial_number: str, escrow_key: Optional[str] = None, lost_message: Optional[str] = None)[source]¶Lock a device with Activation Lock.
activation_lock_bypass(serial_number: str, product_type: str, org_name: str, guid: str, escrow_key: str, imei: Optional[str] = None, meid: Optional[str] = None)[source]¶Remove Activation Lock from a device.
assign_profile(profile_uuid: str, *serial_numbers) → dict[source]¶Assign an existing profile to device(s)
| Parameters: |
|
|---|---|
| Returns: | Assignment information |
| Return type: | dict |
define_profile(profile: dict)[source]¶Define a DEP profile
| Parameters: | profile (dict) – A DEP profile. |
|---|
device_detail(*serial_numbers)[source]¶Fetch detail about a list of devices
| Parameters: | serial_numbers (List[str]) – A list of device serial numbers to fetch details for. |
|---|---|
| Returns: | Device information |
| Return type: | dict |
devices(cursor: Optional[str] = None) → collections.abc.Iterator[source]¶Get an iterable object which calls fetch or sync to retrieve all device records.
| Parameters: | cursor (str) – If supplied, the cursor returned will perform the sync operation. Otherwise you will receive a cursor that performs a fetch for each iteration, until the fetch cursor is exhausted. |
|---|---|
| Returns: | A cursor that is iterable |
| Return type: | Union[DEPSyncCursor, DEPFetchCursor] |
disown(*serial_numbers)[source]¶Disown devices.
This action is PERMANENT (except in the case of iPads added via Apple Configurator 2).
fetch_devices(cursor: Optional[str] = None, limit: int = 100) → dict[source]¶Fetch a list of DEP devices
| Parameters: |
|
|---|---|
| Returns: | Response as per the sync devices documentation. |
| Return type: | dict |
fetch_token() → Optional[str][source]¶Request a new session token using our DEP credentials.
| Returns: | The token that was returned (already set on this instance), or None if it failed. |
|---|---|
| Return type: | Union[str, None] |
from_token(token: str)[source]¶Instantiate the DEP client instance from a string holding the service token json content.
profile(uuid: str) → dict[source]¶Get an existing profile by its UUID.
| Parameters: | uuid (str) – Profile UUID |
|---|---|
| Returns: | Profile |
| Return type: | dict |
remove_profile(*serial_numbers) → Dict[str, commandment.dep.DEPProfileRemovalStatus][source]¶Unassign all profiles from device(s)
| Parameters: | serial_numbers (List[str]) – A list of serial numbers to unassign from that profile. |
|---|---|
| Returns: | Assignment information |
| Return type: | dict |
send(req: requests.models.Request, **kwargs) → Optional[requests.models.Response][source]¶Send a request to the DEP service.
If the service responds that the token has expired, fetch a new session token and re-issue the request.
| Parameters: | req (requests.Request) – The request, which will have DEP auth headers added to it. |
|---|---|
| Returns: | The response |
| Return type: | requests.Response |
sync_devices(cursor: str, limit: int = 100) → dict[source]¶Fetch devices changed since the cursor was issued.
| Parameters: |
|
|---|---|
| Returns: | Response as per the sync devices documentation. |
| Return type: | dict |