Collect Jamf Software data to csv file

This python script will collect Jamf Software data from this source and save it to a csv file in /Users/shared.

This Python script uses the requests library to get data from the website and pandas library to output it as a CSV file. Save this as a Python (py) script and run it on your Mac:

Make sure to install the required libraries (requests and pandas) by running:

Copy code
pip install requests pandas
pip3 install requests pandas

import requests
import pandas as pd
import os
import datetime
# Get data from website
response = requests.get('')
data = response.json()
# Convert data to pandas DataFrame
df = pd.DataFrame(data)
# Get timestamp
timestamp ="%Y%m%d_%H%M%S")
# Get Users Shared directory path
shared_dir = os.path.expanduser('/Users/Shared')
# Ensure the shared directory exists
os.makedirs(shared_dir, exist_ok=True)
# Name of the output file
file_name = os.path.join(shared_dir, f'output_{timestamp}.csv')
# Save DataFrame to CSV file in Users Shared folder
df.to_csv(file_name, index=False, encoding='utf-8')
print(f"Data saved to {file_name}")

view raw

hosted with ❤ by GitHub


No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *