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
    })

    # 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)

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

Requirements

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

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.1.tar.gz (30.3 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.1-py3-none-any.whl (35.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyonstar-0.0.1.tar.gz
  • Upload date:
  • Size: 30.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for pyonstar-0.0.1.tar.gz
Algorithm Hash digest
SHA256 04fa893243a4d78f62ce05b0a28728f103c16b51451bf9777a2299ca22e24b65
MD5 b790a672aa2031042c80c8c2e1daf7b7
BLAKE2b-256 511e3007cc67747929d3f337fb7997c593b3b32238f8fb3e09be7dc6560f0ca5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyonstar-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 35.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for pyonstar-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1b81c6beba9708d91eabc8cf2f75fd9439854f17c6fea02d6f56ab8ab136146e
MD5 caee4d4c00ccf3e563a3ca952dc0fb19
BLAKE2b-256 602cad42e794616009ee8721e49e89f85185f5305a9973f277b0f4810368acf6

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