pyaxm


Namepyaxm JSON
Version 2025.8.5 PyPI version JSON
download
home_pageNone
SummaryQuery Apple Business Manager using Python
upload_time2025-08-05 21:42:55
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords abm apple business manager axm
VCS
bugtrack_url
requirements pydantic requests Authlib pycryptodomex pandas typer
Travis-CI No Travis.
coveralls test coverage No coveralls.
            The purpose of this repo is to create a python library to easily get information using the Apple Business Manager API using Python.

A CLI command is also included, `pyacm-cli`.

https://developer.apple.com/documentation/applebusinessmanagerapi

## Setup
If you want to setup the authentication using envvars, do the following:

You will need to setup 2 environmental variables that are provided
when creating the private key in ABM:

`AXM_CLIENT_ID` and `AXM_KEY_ID`

Place the private key in your home directory inside the `.config/pyaxm` folder
and rename it `key.pem`

This location will be used to store a cached access_token that can be reused
until it expires. While testing I have experienced that requesting too many
access tokens will result in a response with status code 400 when 
trying to get a new token.

Otherwise you will have to pass the client id, key id and private key as arguments
to the client like so:

```from pyaxm.client import Client

axm_client = Client(
    axm_client_id="CLIENT_ID",
    axm_key_id="KEY_ID",
    key_path="PRIVATE_KEY",
    token_path="TOKEN_PATH"
)

The token path is the location where the access token will be stored.
```

## Installation:
`pip install pyaxm`

## CLI:
Usage: pyaxm-cli COMMAND [ARGS]

### Commands
`devices` -> List all devices in the organization.

`device` -> Get a device by ID.

`mdm-servers` -> List all MDM servers.

`mdm-server` -> List devices in a specific MDM server.

`mdm-server-assigned` -> Get the server assignment for a device.

`assign-device` -> Assign a device to an MDM server.

`unassign-device` -> Unassign a device from an MDM server.

The data returned is on CSV format so you can store it as a CSV if needed

# Client:
Example usage:
```from pyaxm.client import Client

axm_client = Client()

devices = axm_client.list_devices()
print(devices)

device = axm_client.get_device(device_id='SERIAL_NUMBER')
print(device)

mdm_servers = axm_client.list_mdm_servers()
print(mdm_servers)

# The MDM server ID can be extracted from listing all mdm servers
mdm_server = axm_client.list_devices_in_mdm_server(server_id="MDM_SERVER_ID")
print(mdm_server)

device_assigned_server = axm_client.list_devices_in_mdm_server(device_id='SERIAL_NUMBER')
print(device_assigned_server)

assignment_result = axm_client.assign_unassign_device_to_mdm_server(
    device_id='SERIAL_NUMBER',
    server_id="MDM_SERVER_ID",
    action="ASSIGN_DEVICES"|"UNASSIGN_DEVICES"
)
```

## Issues:
* need to add tests
* unassign, assign devices need to be able to pass more than 1 device

This is still a work in progress

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyaxm",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "abm, apple business manager, axm",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/d8/c3/3b72a5627dfb64ca9b2f211e016ddba9105075fa7944b2b3f220adf19a79/pyaxm-2025.8.5.tar.gz",
    "platform": null,
    "description": "The purpose of this repo is to create a python library to easily get information using the Apple Business Manager API using Python.\n\nA CLI command is also included, `pyacm-cli`.\n\nhttps://developer.apple.com/documentation/applebusinessmanagerapi\n\n## Setup\nIf you want to setup the authentication using envvars, do the following:\n\nYou will need to setup 2 environmental variables that are provided\nwhen creating the private key in ABM:\n\n`AXM_CLIENT_ID` and `AXM_KEY_ID`\n\nPlace the private key in your home directory inside the `.config/pyaxm` folder\nand rename it `key.pem`\n\nThis location will be used to store a cached access_token that can be reused\nuntil it expires. While testing I have experienced that requesting too many\naccess tokens will result in a response with status code 400 when \ntrying to get a new token.\n\nOtherwise you will have to pass the client id, key id and private key as arguments\nto the client like so:\n\n```from pyaxm.client import Client\n\naxm_client = Client(\n    axm_client_id=\"CLIENT_ID\",\n    axm_key_id=\"KEY_ID\",\n    key_path=\"PRIVATE_KEY\",\n    token_path=\"TOKEN_PATH\"\n)\n\nThe token path is the location where the access token will be stored.\n```\n\n## Installation:\n`pip install pyaxm`\n\n## CLI:\nUsage: pyaxm-cli COMMAND [ARGS]\n\n### Commands\n`devices` -> List all devices in the organization.\n\n`device` -> Get a device by ID.\n\n`mdm-servers` -> List all MDM servers.\n\n`mdm-server` -> List devices in a specific MDM server.\n\n`mdm-server-assigned` -> Get the server assignment for a device.\n\n`assign-device` -> Assign a device to an MDM server.\n\n`unassign-device` -> Unassign a device from an MDM server.\n\nThe data returned is on CSV format so you can store it as a CSV if needed\n\n# Client:\nExample usage:\n```from pyaxm.client import Client\n\naxm_client = Client()\n\ndevices = axm_client.list_devices()\nprint(devices)\n\ndevice = axm_client.get_device(device_id='SERIAL_NUMBER')\nprint(device)\n\nmdm_servers = axm_client.list_mdm_servers()\nprint(mdm_servers)\n\n# The MDM server ID can be extracted from listing all mdm servers\nmdm_server = axm_client.list_devices_in_mdm_server(server_id=\"MDM_SERVER_ID\")\nprint(mdm_server)\n\ndevice_assigned_server = axm_client.list_devices_in_mdm_server(device_id='SERIAL_NUMBER')\nprint(device_assigned_server)\n\nassignment_result = axm_client.assign_unassign_device_to_mdm_server(\n    device_id='SERIAL_NUMBER',\n    server_id=\"MDM_SERVER_ID\",\n    action=\"ASSIGN_DEVICES\"|\"UNASSIGN_DEVICES\"\n)\n```\n\n## Issues:\n* need to add tests\n* unassign, assign devices need to be able to pass more than 1 device\n\nThis is still a work in progress\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Query Apple Business Manager using Python",
    "version": "2025.8.5",
    "project_urls": {
        "Repository": "https://github.com/kaincenteno/pyaxm"
    },
    "split_keywords": [
        "abm",
        " apple business manager",
        " axm"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "768fd419831164558db1d01918ee2474d9edce0889f55797033878571e46ec43",
                "md5": "128e51135999f51c2588f2d42dbaa184",
                "sha256": "1548e0bf10ab685b3c3393de661630e6d658808debeed9a62c5ff7eea474ee73"
            },
            "downloads": -1,
            "filename": "pyaxm-2025.8.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "128e51135999f51c2588f2d42dbaa184",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 20703,
            "upload_time": "2025-08-05T21:42:54",
            "upload_time_iso_8601": "2025-08-05T21:42:54.484600Z",
            "url": "https://files.pythonhosted.org/packages/76/8f/d419831164558db1d01918ee2474d9edce0889f55797033878571e46ec43/pyaxm-2025.8.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d8c33b72a5627dfb64ca9b2f211e016ddba9105075fa7944b2b3f220adf19a79",
                "md5": "9ea9aa64b6956798c7b3e5de77823e5b",
                "sha256": "6c38b1fa3685cca069d778b2e5323d6f5986f7a18b87ebbf7a17e24c57103ca0"
            },
            "downloads": -1,
            "filename": "pyaxm-2025.8.5.tar.gz",
            "has_sig": false,
            "md5_digest": "9ea9aa64b6956798c7b3e5de77823e5b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 20780,
            "upload_time": "2025-08-05T21:42:55",
            "upload_time_iso_8601": "2025-08-05T21:42:55.771905Z",
            "url": "https://files.pythonhosted.org/packages/d8/c3/3b72a5627dfb64ca9b2f211e016ddba9105075fa7944b2b3f220adf19a79/pyaxm-2025.8.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-05 21:42:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kaincenteno",
    "github_project": "pyaxm",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "pydantic",
            "specs": []
        },
        {
            "name": "requests",
            "specs": []
        },
        {
            "name": "Authlib",
            "specs": []
        },
        {
            "name": "pycryptodomex",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": []
        },
        {
            "name": "typer",
            "specs": []
        }
    ],
    "lcname": "pyaxm"
}
        
Elapsed time: 1.91296s