Skip to main content

A full-featured Python client for the SimpleSat API

Project description

pysimplesat - An API library for SimpleSAT, written in Python

pySimpleSAT is a full-featured, type annotated API client written in Python for the SimpleSAT APIs.

This library has been developed with the intention of making the SimpleSAT APIs simple and accessible to non-coders while allowing experienced coders to utilize all features the API has to offer without the boilerplate.

Features:

  • 100% API Coverage. All endpoints and response models.
  • Non-coder friendly. 100% annotated for full IDE auto-completion. Clients handle requests and authentication - just plug the right details in and go!
  • Fully annotated. This library has a strong focus on type safety and type hinting. Models are declared and parsed using Pydantic

pySimpleSAT is currently in development.

Known Issues:

  • As this project is still a WIP, documentation or code commentary may not always align.

Road Map:

How-to:

Install

Open a terminal and run pip install pysimplesat

Initializing the API Clients

SimpleSAT API

from pysimplesat import SimpleSATAPIClient

# init client
sat_api_client = SimpleSATAPIClient(
  # your api private key,
)

Working with Endpoints

Endpoints are 1:1 to what's available for SimpleSAT.

For more information, check out the following resources:

Get many

# sends GET request to /company/companies endpoint
companies = sat_api_client.company.companies.get()

Get one

# sends GET request to /company/companies/{id} endpoint
accounts = sat_api_client.accounts.id("abc123").get()

Get with params

# sends GET request to /company/companies with a conditions query string
conditional_company = sat_api_client.company.companies.get(params={
  'conditions': 'company/id=250'
})

Pagination

To make working with paginated data easy, Endpoints that implement a GET response with an array also supply a paginated() method. Under the hood this wraps a GET or POST request as required, but does a lot of neat stuff to make working with pages easier.

Working with pagination

# initialize a PaginatedResponse instance for /agents, starting on page 1 with a pageSize of 100
paginated_agents = sat_api_client.agents.paginated(1,100)

# access the data from the current page using the .data field
page_one_data = paginated_agents.data

# if there's a next page, retrieve the next page worth of data
paginated_agents.get_next_page()

# if there's a previous page, retrieve the previous page worth of data
paginated_agents.get_previous_page()

# iterate over all companies on the current page
for agent in paginated_agents:
  # ... do things ...

# iterate over all companies in all pages
# this works by yielding every item on the page, then fetching the next page and continuing until there's no data left
for agent in paginated_agents.all():
  # ... do things ...

Contributing

Contributions to the project are welcome. If you find any issues or have suggestions for improvement, please feel free to open an issue or submit a pull request.

Supporting the project

:heart:

Inspiration and Stolen Code

The premise behind this came from the pyConnectWise package and I stole most of the code and adapted it to the SimpleSAT API endpoints.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysimplesat-0.1.10.tar.gz (29.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysimplesat-0.1.10-py3-none-any.whl (44.9 kB view details)

Uploaded Python 3

File details

Details for the file pysimplesat-0.1.10.tar.gz.

File metadata

  • Download URL: pysimplesat-0.1.10.tar.gz
  • Upload date:
  • Size: 29.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysimplesat-0.1.10.tar.gz
Algorithm Hash digest
SHA256 328339f1bc7af41c86d1139974df7801106d5e7a79e0e786b503141811bcf38f
MD5 7ca40a6ea1ee6bfa025191d8a9425622
BLAKE2b-256 05b4785ce31bb38f00898e9a2442d2375f7310894d2b6f5da60e8215e9404bfb

See more details on using hashes here.

File details

Details for the file pysimplesat-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: pysimplesat-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 44.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysimplesat-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 52fd9c62c7167a37186d2d59111604072a979f778d607e740cf5ea1d20a5bb8d
MD5 aebf1d5d9ae64cb40e28484b23396282
BLAKE2b-256 103ab26bd77b3ae425fca2cec5eacd678634f60f1c4e2b1d8f0c5c7f0c57224e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page