Mazda Connected Service API wrapper based on pymazda and Flask.

Overview

Mazda Connected Service Relay

Mazda Connected Service API wrapper based on pymazda and Flask.

Usage

Make POST calls to https://mymazda.herokuapp.com/{endpoint}, where endpoint could be something like startEngine. To make a valid request, you will need to attach a JSON payload with the following fields:

{
  "username": your_mazda_email,
  "password": your_mazda_password,
  "vid": internal_vehicle_id,
}

To obtain the vid for your vehicle, you can first make a POST call to https://mymazda.herokuapp.com/vehicles with just the username and password as the JSON payload. After getting a list of vehicles, find id associated with it. It will be the vid of your future API requests.

Below are some examples of API usage. To see a full list of API endpoints, see app.py.

Example: Start / Stop Engine

POST the above JSON to https://mymazda.herokuapp.com/startEngine or https://mymazda.herokuapp.com/stopEngine to start / stop the engine.

Example: Send navigation destination to infortainment

Send the following JSON to https://mymazda.herokuapp.com/sendPOI. Note that you need the navigation SD card for it to work.

{
  "username": your_mazda_email,
  "password": your_mazda_password,
  "vid": internal_vehicle_id,
  "longitude": longitude_float,
  "latitude": latitude_float,
  "name": name
}

iOS Shortcuts Example

You might also like...
A new coin listing alert bot using Python, Flask, MongoDB, Telegram API and Binance API
A new coin listing alert bot using Python, Flask, MongoDB, Telegram API and Binance API

Bzzmans New Coin Listing Detection Bot Architecture About Project Work in progress. This bot basically gets new coin listings from Binance using Binan

PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.

PRAW: The Python Reddit API Wrapper PRAW, an acronym for "Python Reddit API Wrapper", is a Python package that allows for simple access to Reddit's AP

Python API wrapper around Trello's API

A wrapper around the Trello API written in Python. Each Trello object is represented by a corresponding Python object. The attributes of these objects

PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.

PRAW: The Python Reddit API Wrapper PRAW, an acronym for "Python Reddit API Wrapper", is a Python package that allows for simple access to Reddit's AP

An API wrapper around the pythonanywhere's API.

pyaww An API wrapper around the pythonanywhere's API. The name stands for pythonanywherewrapper. 100% api coverage most of the codebase is documented

Async ready API wrapper for Revolt API written in Python.

Mutiny Async ready API wrapper for Revolt API written in Python. Installation Python 3.9 or higher is required To install the library, you can just ru

An API Wrapper for Gofile API

Gofile2 from gofile2 import Gofile g_a = Gofile() print(g_a.upload(file="/home/itz-fork/photo.png")) An API Wrapper for Gofile API. About API Gofile

A simple API wrapper for the Tenor API

Gifpy A simple API wrapper for the Tenor API Installation Python 3.9 or higher is recommended python3 -m pip install gifpy Clone repository: $ git cl

A Python API wrapper for the Twitter API!

PyTweet PyTweet is an api wrapper made for twitter using twitter's api version 2! Installation Windows py3 -m pip install PyTweet Linux python -m pip

Comments
  • Error getting server response

    Error getting server response

    Hi,

    I'm getting this very strange error in my forked Heroku instance. Functions like start the engine works fine but the return value causes a 500 error. I tried deploying the same code on my local machine but it doesn't give any error.

    Any ideas?

    Thank you

    2022-01-23T05:27:08.823853+00:00 heroku[router]: at=info method=POST path="/vehiclesStatus" host=mazda-xxx.herokuapp.com request_id=d55bdac6-4930-4b49-ba60-06ab7273ea26 fwd="76.121.172.145" dyno=web.1 connect=0ms service=79ms status=500 bytes=463 protocol=https
    2022-01-23T05:27:08.821795+00:00 app[web.1]: [2022-01-23 05:27:08,821] ERROR in app: Exception on /vehiclesStatus [POST]
    2022-01-23T05:27:08.821800+00:00 app[web.1]: Traceback (most recent call last):
    2022-01-23T05:27:08.821801+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
    2022-01-23T05:27:08.821801+00:00 app[web.1]:     response = self.full_dispatch_request()
    2022-01-23T05:27:08.821809+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request
    2022-01-23T05:27:08.821810+00:00 app[web.1]:     rv = self.handle_user_exception(e)
    2022-01-23T05:27:08.821810+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request
    2022-01-23T05:27:08.821810+00:00 app[web.1]:     rv = self.dispatch_request()
    2022-01-23T05:27:08.821811+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request
    2022-01-23T05:27:08.821811+00:00 app[web.1]:     return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
    2022-01-23T05:27:08.821812+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/asgiref/sync.py", line 204, in __call__
    2022-01-23T05:27:08.821813+00:00 app[web.1]:     return call_result.result()
    2022-01-23T05:27:08.821813+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/concurrent/futures/_base.py", line 439, in result
    2022-01-23T05:27:08.821813+00:00 app[web.1]:     return self.__get_result()
    2022-01-23T05:27:08.821814+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
    2022-01-23T05:27:08.821814+00:00 app[web.1]:     raise self._exception
    2022-01-23T05:27:08.821814+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/asgiref/sync.py", line 270, in main_wrap
    2022-01-23T05:27:08.821815+00:00 app[web.1]:     result = await self.awaitable(*args, **kwargs)
    2022-01-23T05:27:08.821815+00:00 app[web.1]:   File "/app/app.py", line 44, in getStatus
    2022-01-23T05:27:08.821816+00:00 app[web.1]:     status = await client.get_vehicle_status(vid)
    2022-01-23T05:27:08.821816+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/pymazda/client.py", line 65, in get_vehicle_status
    2022-01-23T05:27:08.821816+00:00 app[web.1]:     vehicle_status_response = await self.controller.get_vehicle_status(vehicle_id)
    2022-01-23T05:27:08.821817+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/pymazda/controller.py", line 31, in get_vehicle_status
    2022-01-23T05:27:08.821817+00:00 app[web.1]:     response = await self.connection.api_request("POST", "remoteServices/getVehicleStatus/v4", body_dict=post_body, needs_keys=True, needs_auth=True)
    2022-01-23T05:27:08.821818+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/pymazda/connection.py", line 158, in api_request
    2022-01-23T05:27:08.821818+00:00 app[web.1]:     return await self.__api_request_retry(method, uri, query_dict, body_dict, needs_keys, needs_auth, num_retries=0)
    2022-01-23T05:27:08.821819+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/pymazda/connection.py", line 165, in __api_request_retry
    2022-01-23T05:27:08.821819+00:00 app[web.1]:     await self.__ensure_keys_present()
    2022-01-23T05:27:08.821819+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/pymazda/connection.py", line 253, in __ensure_keys_present
    2022-01-23T05:27:08.821820+00:00 app[web.1]:     await self.__retrieve_keys()
    2022-01-23T05:27:08.821820+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/pymazda/connection.py", line 268, in __retrieve_keys
    2022-01-23T05:27:08.821820+00:00 app[web.1]:     response = await self.api_request("POST", "service/checkVersion", needs_keys=False, needs_auth=False)
    2022-01-23T05:27:08.821820+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/pymazda/connection.py", line 158, in api_request
    2022-01-23T05:27:08.821820+00:00 app[web.1]:     return await self.__api_request_retry(method, uri, query_dict, body_dict, needs_keys, needs_auth, num_retries=0)
    2022-01-23T05:27:08.821821+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/pymazda/connection.py", line 173, in __api_request_retry
    2022-01-23T05:27:08.821822+00:00 app[web.1]:     return await self.__send_api_request(method, uri, query_dict, body_dict, needs_keys, needs_auth)
    2022-01-23T05:27:08.821822+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/pymazda/connection.py", line 229, in __send_api_request
    2022-01-23T05:27:08.821822+00:00 app[web.1]:     response_json = await response.json()
    2022-01-23T05:27:08.821822+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1103, in json
    2022-01-23T05:27:08.821823+00:00 app[web.1]:     raise ContentTypeError(
    2022-01-23T05:27:08.821824+00:00 app[web.1]: aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://0cxo7m58.mazda.com/prod/service/checkVersion')
    
    opened by siyu6974 3
Owner
Alan Chen
Ph.D. Student in Information & Decision Sciences @ Carlson School of Management.
Alan Chen
Design and build a wrapper for the Open Weather API current weather data service

Design and build a wrapper for the Open Weather API current weather data service that returns a city's temperature, with caching, also allowing for the temperature of the latest queried cities that are still validly cached to be retrieved.

Duan Rafael Ribeiro 1 Jun 27, 2022
:globe_with_meridians: A Python wrapper for the Geocodio geolocation service API

Py-Geocodio Python wrapper for Geocodio geocoding API. Full documentation on Read the Docs. If you are upgrading from a version prior to 0.2.0 please

Ben Lopatin 84 Aug 2, 2022
An API wrapper for the file.io web service.

??️ File.io An API wrapper for the file.io web service. Install $ pip3 install fileio or

nkot56297 1 Dec 18, 2021
A Python API for Connected 2

connected API for Connected 2 api for the { connected 2 } programmer : api report api follow api check username api forget password api Search api cha

null 2 Jun 5, 2022
A Flask inspired, decorator based API wrapper for Python-Slack.

A Flask inspired, decorator based API wrapper for Python-Slack. About Tangerine is a lightweight Slackbot framework that abstracts away all the boiler

Nick Ficano 149 Jun 30, 2022
Aws-lambda-requests-wrapper - Request/Response wrapper for AWS Lambda with API Gateway

AWS Lambda Requests Wrapper Request/Response wrapper for AWS Lambda with API Gat

null 1 May 20, 2022
A simple Python wrapper for the archive.is capturing service

archiveis A simple Python wrapper for the archive.is capturing service. Installation pipenv install archiveis Python Usage Import it. >>> import archi

PastPages 157 Dec 28, 2022
A Discord.py bot which can adjust a voice channel's bitrate depending on the number of users connected.

discord_bitrate_bot A Discord.py bot which can adjust a voice channel's bitrate depending on the number of users connected. Programmed to be run on a

null 1 Feb 10, 2022
A wrapper for The Movie Database API v3 and v4 that only uses the read access token (not api key).

fulltmdb A wrapper for The Movie Database API v3 and v4 that only uses the read access token (not api key). Installation Use the package manager pip t

Jacob Hale 2 Sep 26, 2021
Beyonic API Python official client library simplified examples using Flask, Django and Fast API.

Beyonic API Python official client library simplified examples using Flask, Django and Fast API.

Harun Mbaabu Mwenda 46 Sep 1, 2022