Using Python for API calls

Modified on Tue, 19 Mar at 4:31 PM

Below is the URL to sample ARMOR Python scripts that can help integration teams understand how to properly interact with the ARMOR API via scripted integrations. 


** These are sample scripts and not meant for production environments


ARMOR Python Scripts Link

This package provides useful sample scripts for interacting with the ARMOR Fleet Management platform from Python.


It implements the REST API that is available here: https://app.armordata.io/swaggerui/


This package is expected to change frequently, and may be replaced by a formal python SDK in the future.


Using the client

from client import ArmorClient

# authenticating with an application token

client = ArmorClient("https://app.armordata.io/api/v1/", token="AT:adfasdf....asdfasd")

# authenticating with a username and password

client = ArmorClient("https://app.armordata.io/api/v1/", username="user@domain.com", password="password")

resp = client.request("GET", "asset", query={"limit": 20})

Utilities

legacy_raw_report.py

This utility creates a history report that is compatible with the "Raw Data Report" from the old Armor platform.

python legacy_raw_report.py -t "AT:xxxx" -d 30
  • -u: The URL used to access the Armor platform API.

  • -t: The application token used to authenticate with the platform.

  • -d: The number of days of history to download.


scrape_data.py

This utility downloads assets, sites, and history to JSON files.

python scrape_data.py -t "AT:xxxx" -d 30

  • -u: The URL used to access the Armor platform API.
  • -t: The application token used to authenticate with the platform.
  • -d: The number of days of history to download.


scrape_csv.py

This utility creates a CSV file with all assets and site data combined into a single csv table.


python scrape_csv.py -t "AT:xxxx" -d 30

  • -u: The URL used to access the Armor platform API.
  • -t: The application token used to authenticate with the platform.


Known Limitations

The client does not handle all network and timing errors gracefully.


--ARMOR Support

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article