Skip to main content

Python SDK for the Synup API

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Synup Python SDK

Python SDK for the Synup API. Install with pip and call the API using your API key.

Installation

pip install synup-sdk

For local development from the engineering-scripts repo:

pip install -e synup-sdk

Configuration

Create a client with your API key. You can generate API keys from your Synup workspace: Settings → Integrations → Generate.

from synup import SynupClient

client = SynupClient(api_key="YOUR_API_KEY")

Optional: use a custom base URL (default is https://api.synup.com):

client = SynupClient(api_key="YOUR_API_KEY", base_url="https://api.synup.com")

Fetch all locations

Single page (with pagination)

Get one page of locations and use the returned cursors to paginate:

result = client.fetch_all_locations(first=10)

# List of location dicts
locations = result["locations"]

# Pagination info
page_info = result["page_info"]
# page_info["has_next_page"], page_info["has_previous_page"]
# page_info["start_cursor"], page_info["end_cursor"]

# Next page
if page_info["has_next_page"]:
    next_result = client.fetch_all_locations(first=10, after=page_info["end_cursor"])

All locations (auto-paginate)

Fetch every location in one call; the SDK will follow cursors until all are retrieved:

all_locations = client.fetch_all_locations(fetch_all=True)
# all_locations is a list of location dicts

Optional: set page size when using fetch_all=True (default is 100):

all_locations = client.fetch_all_locations(fetch_all=True, page_size=50)

Errors

On non-2xx API responses, the client raises SynupAPIError:

from synup import SynupClient, SynupAPIError

client = SynupClient(api_key="...")
try:
    client.fetch_all_locations()
except SynupAPIError as e:
    print(e.status_code, e.response_body)

Version

Current version: 0.1.0

Publishing (deploy)

The SDK is published to PyPI using GitHub Actions in the engineering-scripts repo.

  • Tests: Run automatically on PRs and pushes that touch synup-sdk/.
  • Publish (staging): In the engineering-scripts repo go to Actions → synup-sdk → Run workflow, choose testpypi, and run. Add repo secret TEST_PYPI_API_TOKEN (Test PyPI API token).
  • Publish (production): Same flow, choose pypi. Add repo secret PYPI_API_TOKEN (PyPI API token).

After publishing to Test PyPI, install with:
pip install --index-url https://test.pypi.org/simple/ synup-sdk

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

synup_sdk-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

synup_sdk-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file synup_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: synup_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for synup_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 baaa9a435233beb4c47c25738c21ebcc580ff9bd07008b99c8ef21d8fad80a8e
MD5 502ac48bbe3c426494e821054ee494db
BLAKE2b-256 4ecfed257b433a089cc9caa6b1e2aa6c883c384f020139bc04aba6d5ec8555e9

See more details on using hashes here.

File details

Details for the file synup_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: synup_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for synup_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1eaa2246183bc363be7cad78722619fc21ce464d7812a680d20c3d8d9204036b
MD5 fe46648107c56f440a878c2b6e08a13e
BLAKE2b-256 1755da7fe40a0ca6787523fbfcd847f7cd9414f383e679c01c4a95fa794c3fed

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