Skip to main content

Unofficial package for making OnStar API requests

Project description

PyOnStar

Unofficial Python package for making OnStar API requests. This is a Python port of the original OnStarJS package.

Note: This project was primarily developed through AI-assisted "vibe-coding" - using AI tools to help port the JavaScript codebase to Python while maintaining the original functionality.

Installation

pip install pyonstar

Usage

import asyncio
from pyonstar import OnStar

async def main():
    # Create OnStar instance
    onstar = OnStar.create({
        "username": "your_username",
        "password": "your_password",
        "device_id": "your_device_id",
        "vin": "your_vin",
        "onstar_pin": "your_pin",  # Optional
        "totp_secret": "your_totp_secret"  # Optional
    })

    try:
        # Get account vehicles
        result = await onstar.get_account_vehicles()
        print(result)

        # Start vehicle
        result = await onstar.start()
        print(result)

        # Lock doors
        result = await onstar.lock_door()
        print(result)

        # Get vehicle location
        result = await onstar.location()
        print(result)
    finally:
        # Always close the client when done
        await onstar.close()

if __name__ == "__main__":
    asyncio.run(main())

Features

  • Account vehicle information
  • Remote start/stop
  • Door lock/unlock
  • Trunk lock/unlock
  • Vehicle alerts
  • Charging profile management
  • Vehicle diagnostics
  • Location tracking
  • Non-blocking async I/O for optimal performance
  • Proper resource management

Requirements

  • Python 3.10 or higher
  • Required packages (automatically installed):
    • httpx
    • pyjwt
    • pyotp
    • aiofiles

Credits

This project is a Python port of:

  • OnStarJS - NodeJS Library for making OnStar API requests

License

MIT License - See LICENSE file for details

Running Tests

This project uses pytest for testing. To run the tests:

  1. Install development dependencies:

    pip install -r requirements-dev.txt
    
  2. Run tests:

    pytest
    
  3. Run tests with coverage:

    pytest --cov=pyonstar
    

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

pyonstar-0.0.6.tar.gz (31.5 kB view details)

Uploaded Source

Built Distribution

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

pyonstar-0.0.6-py3-none-any.whl (36.9 kB view details)

Uploaded Python 3

File details

Details for the file pyonstar-0.0.6.tar.gz.

File metadata

  • Download URL: pyonstar-0.0.6.tar.gz
  • Upload date:
  • Size: 31.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyonstar-0.0.6.tar.gz
Algorithm Hash digest
SHA256 4f48f4fb7dda2a66bd280124f944ce2568a9786b5dbaab3fc2ac9716fecd9de0
MD5 43b3434fa30f4859a2e91a4b46ba3975
BLAKE2b-256 b702926954577ea64567af6354e8a7aa33d4fce2e9b92f31334fc6d6dd50f2f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyonstar-0.0.6.tar.gz:

Publisher: publish-pypi.yml on leboff/pyonstar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyonstar-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: pyonstar-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 36.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyonstar-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c87ee467f889eae7caf2d46fcf07a39277faa9f77cc5dc766c2bf84ed656551d
MD5 7632064ef418ff6ff04bdd90b66f0c24
BLAKE2b-256 67acddaef041158e49ddef7d676c240bd74e61565b84586f03ef1c52ccabfb7e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyonstar-0.0.6-py3-none-any.whl:

Publisher: publish-pypi.yml on leboff/pyonstar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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