From 8c3eb1604f795dcaee81ab20a083602567718653 Mon Sep 17 00:00:00 2001 From: Ian Date: Thu, 23 Dec 2021 20:58:11 -0600 Subject: [PATCH] request_update()-Send request to refresh data from the cars module (#38) --- README.md | 44 +- {syncconnect => connectedcar}/__init__.py | 4 +- {syncconnect => connectedcar}/api.py | 0 .../connectedcar.py | 0 {syncconnect => connectedcar}/const.py | 0 {syncconnect => connectedcar}/exceptions.py | 0 {syncconnect => connectedcar}/requester.py | 0 {syncconnect => connectedcar}/user.py | 0 {syncconnect => connectedcar}/vehicle.py | 10 +- docs/api.html | 995 +++++++-- docs/connectedcar.html | 876 ++++++++ docs/const.html | 530 ++++- docs/exceptions.html | 1111 +++++++--- docs/index.html | 710 +++++- docs/requester.html | 623 +++++- docs/syncconnect.html | 374 ---- docs/user.html | 841 +++++-- docs/vehicle.html | 1951 ++++++++++++----- examples/start-vehicle.py | 8 +- examples/vehicle-info.py | 8 +- setup.py | 10 +- tests/unit/test_api.py | 2 +- tests/unit/test_requester.py | 34 +- tests/unit/test_syncconnect.py | 6 +- tests/unit/test_user.py | 6 +- tests/unit/test_vehicle.py | 6 +- 26 files changed, 6220 insertions(+), 1929 deletions(-) rename {syncconnect => connectedcar}/__init__.py (83%) rename {syncconnect => connectedcar}/api.py (100%) rename syncconnect/syncconnect.py => connectedcar/connectedcar.py (100%) rename {syncconnect => connectedcar}/const.py (100%) rename {syncconnect => connectedcar}/exceptions.py (100%) rename {syncconnect => connectedcar}/requester.py (100%) rename {syncconnect => connectedcar}/user.py (100%) rename {syncconnect => connectedcar}/vehicle.py (97%) create mode 100644 docs/connectedcar.html delete mode 100644 docs/syncconnect.html diff --git a/README.md b/README.md index 6ea5ec8..bb759e9 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,35 @@ -![Sync Connect Python SDK Logo](https://user-images.githubusercontent.com/35158392/111222780-4bf1bb80-85aa-11eb-8be2-271ae5f32936.png) +![ConnectedCar Python SDK Logo](https://user-images.githubusercontent.com/35158392/147300580-29723aab-ffae-46d3-ae60-72af59065daa.png) + +The ConnectedCar Python SDK is an open-source, python package that provides the ability to send commands to your Ford Sync Connect connected vehicle. + +# Installation [![PyPI version](https://badge.fury.io/py/connectedcar.svg)](https://badge.fury.io/py/connectedcar) -The Sync Connect Python SDK is an open-source, python package that provides the ability to send commands to your Ford Sync Connect connected vehicle. -# Installation [![PyPI version](https://badge.fury.io/py/syncconnect.svg)](https://badge.fury.io/py/syncconnect) ```sh -python3 -m pip install syncconnect +python3 -m pip install connectedcar ``` Requirements + - To make requests to a vehicle, the end user must have signed up for an account using [Ford Pass](https://owner.ford.com/fordpass/fordpass-sync-connect.html). These credentials will be used to authenticate your requests. + # Getting Started -Import the Sync Connect SDK +Import the ConnectedCar SDK + ```python -import syncconnect +import connectedcar ``` +Create a new connectedcar `client` -Create a new syncconnect `client` -- Note the default Sync Connect client_id is -`9fb503e0-715b-47e8-adfd-ad4b7770f73b` +- Note the default ConnectedCar client_id is + `9fb503e0-715b-47e8-adfd-ad4b7770f73b` ```python -client = syncconnect.AuthClient('9fb503e0-715b-47e8-adfd-ad4b7770f73b', None, None) +client = connectedcar.AuthClient('9fb503e0-715b-47e8-adfd-ad4b7770f73b', None, None) ``` -Use `client.get_user_access_token()` to exchange your user credentials for an **access object**. To make any vehicle data request to the Ford Sync Connect API, you'll need to give the SDK a valid **access token**. +Use `client.get_user_access_token()` to exchange your user credentials for an **access object**. To make any vehicle data request to the Ford Sync Connect API, you'll need to give the SDK a valid **access token**. ```python access = client.get_user_access_token('', '') @@ -49,12 +54,14 @@ Access tokens will expire every 2 hours, so you'll need to constantly refresh th refreshToken = client.exchange_refresh_token(access['refreshToke']) ``` -With your access token in hand, use `syncconnect.User()` to get a User object representing the user. +With your access token in hand, use `connectedcar.User()` to get a User object representing the user. + ```python -user = syncconnect.User(access['access_token']) +user = connectedcar.User(access['access_token']) ``` Use `user.vehicles()` to return an array of all the vehicles associated with a users account. The response will include the **vehicle vin**. + ```python vehicles = user.vehicles() @@ -64,21 +71,26 @@ for userVehicle in vehicles: # For each user vehicle vehicleList.append(userVehicle['vin']) ``` -Now with a **vehicle vin** in hand, use `syncconnect.Vehicle()` to get a Vehicle object representing the user's vehicle. +Now with a **vehicle vin** in hand, use `connectedcar.Vehicle()` to get a Vehicle object representing the user's vehicle. + ```python -currentVehicle = syncconnect.Vehicle(vehicleList[0], access['access_token']) # First Vehicle in vehicleList +currentVehicle = connectedcar.Vehicle(vehicleList[0], access['access_token']) # First Vehicle in vehicleList ``` Now you can ask the car to do things, or ask it for some data! For example: + ```python currentVehicle.start() ``` # Examples & Documentation + For more examples on what you can do with Sync Connected car, see the [examples](/examples) folder or take a peek at the [documentation](https://ianjwhite99.github.io/sync-connect-sdk/). # Funding & Support -If you are interested in supporting the development of my projects check out my [patreon](https://www.patreon.com/ianjwhite99) or [buy me a coffee](https://www.buymeacoffee.com/ianjwhite9). + +If you are interested in supporting the development of my projects check out my [patreon](https://www.patreon.com/ianjwhite99) or [buy me a coffee](https://www.buymeacoffee.com/ianjwhite9). # Disclaimer + THIS CODEBASE IS NOT ENDORSED, AFFILIATED, OR ASSOCIATED WITH FORD, FOMOCO OR THE FORD MOTOR COMPANY. diff --git a/syncconnect/__init__.py b/connectedcar/__init__.py similarity index 83% rename from syncconnect/__init__.py rename to connectedcar/__init__.py index 8479e66..fd01eee 100644 --- a/syncconnect/__init__.py +++ b/connectedcar/__init__.py @@ -1,12 +1,12 @@ """ -The Python package `syncconnect` provides a SDK to interact with +The Python package `connectedcar` provides a SDK to interact with Ford Sync Connect enabled vehicles. With this package you will be able to make requests on behalf of a Ford Pass user to: authorize new vehicles, edit current vehicles, return vehicle information, send vehicle commands and return user information. """ -from .syncconnect import (AuthClient) +from .connectedcar import (AuthClient) from .user import User from .vehicle import Vehicle from .exceptions import ( diff --git a/syncconnect/api.py b/connectedcar/api.py similarity index 100% rename from syncconnect/api.py rename to connectedcar/api.py diff --git a/syncconnect/syncconnect.py b/connectedcar/connectedcar.py similarity index 100% rename from syncconnect/syncconnect.py rename to connectedcar/connectedcar.py diff --git a/syncconnect/const.py b/connectedcar/const.py similarity index 100% rename from syncconnect/const.py rename to connectedcar/const.py diff --git a/syncconnect/exceptions.py b/connectedcar/exceptions.py similarity index 100% rename from syncconnect/exceptions.py rename to connectedcar/exceptions.py diff --git a/syncconnect/requester.py b/connectedcar/requester.py similarity index 100% rename from syncconnect/requester.py rename to connectedcar/requester.py diff --git a/syncconnect/user.py b/connectedcar/user.py similarity index 100% rename from syncconnect/user.py rename to connectedcar/user.py diff --git a/syncconnect/vehicle.py b/connectedcar/vehicle.py similarity index 97% rename from syncconnect/vehicle.py rename to connectedcar/vehicle.py index 606fcad..a8a1f0c 100644 --- a/syncconnect/vehicle.py +++ b/connectedcar/vehicle.py @@ -34,21 +34,21 @@ def status(self): return response.json() def refresh_status(self): - """ GET Vehicle.refresh_status + """ PUT Vehicle.refresh_status Returns: - Response: Refresh vehicle status + Response: Send request to refresh data from the cars module Raises: SyncException """ - response = self.api.get( + response = self.api.put( const.API_URL, - 'vehicles/v3/' + + 'vehicles/v2/' + self.vehicle_id + - '/statusrefresh/ffe168a3-657f-4b74-9668-909c60e2379f') + '/status', None) return response.json() def send_auth(self): diff --git a/docs/api.html b/docs/api.html index 777241d..1c11c02 100644 --- a/docs/api.html +++ b/docs/api.html @@ -1,32 +1,440 @@ - + - - - - -syncconnect.api API documentation - - - - - - - - - - - -
-
-
-

Module syncconnect.api

-
-
-
- -Expand source code - -
from . import const, requester
+  
+    
+    
+    
+    connectedcar.api API documentation
+    
+    
+    
+    
+    
+    
+    
+    
+    
+  
+  
+    
+
+
+

Module connectedcar.api

+
+
+
+ + Expand source code + +
from . import const, requester
 
 class Api(object):
 
@@ -142,33 +550,40 @@ 

Module syncconnect.api

headers = self.auth return requester.call(method, url, headers=headers)
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Api -(access_token) -
-
-

Initialize a new Api object to directly make requests to Ford.

-

Args

-
-
access_token : str
-
Ford access token
-
-
- -Expand source code - -
class Api(object):
+          
+
+
+
+
+
+

Classes

+
+
+ + class Api + (access_token) + +
+
+
+

+ Initialize a new Api object to directly make requests to Ford. +

+

Args

+
+
+ access_token : str +
+
Ford access token
+
+
+
+ + Expand source code + +
class Api(object):
 
     def __init__(self, access_token):
         """ Initialize a new Api object to directly make requests to Ford.
@@ -282,33 +697,50 @@ 

Args

headers = self.auth return requester.call(method, url, headers=headers)
-
-

Methods

-
-
-def action(self, method, endpoint, context) -
-
-

Sends universal requests to Ford

-

Args

-
-
method : str
-
the request type
-
endpoint : str
-
the Ford endpoint of interest
-
context : str
-
the API endpoint context
-
-

Returns

-
-
Response
-
response from the request to the Ford API
-
-
- -Expand source code - -
def action(self, method, endpoint, context):
+              
+

Methods

+
+
+ + def action(self, method, endpoint, context) + +
+
+
+

Sends universal requests to Ford

+

Args

+
+
+ method : str +
+
the request type
+
+ endpoint : str +
+
the Ford endpoint of interest
+
+ context : str +
+
the API endpoint context
+
+

Returns

+
+
Response
+
response from the request to the Ford API
+
+
+
+ + Expand source code + +
def action(self, method, endpoint, context):
     """ Sends universal requests to Ford
     
     Args:
@@ -324,30 +756,43 @@ 

Returns

headers = self.auth return requester.call(method, url, headers=headers)
-
-
-
-def delete(self, endpoint, context) -
-
-

Sends DELETE requests to Ford

-

Args

-
-
endpoint : str
-
the Ford endpoint of interest
-
context : str
-
the API endpoint context
-
-

Returns

-
-
Response
-
response from the request to the Ford API
-
-
- -Expand source code - -
def delete(self, endpoint, context):
+                  
+
+
+ + def delete(self, endpoint, context) + +
+
+
+

Sends DELETE requests to Ford

+

Args

+
+
+ endpoint : str +
+
the Ford endpoint of interest
+
+ context : str +
+
the API endpoint context
+
+

Returns

+
+
Response
+
response from the request to the Ford API
+
+
+
+ + Expand source code + +
def delete(self, endpoint, context):
     """ Sends DELETE requests to Ford
     
     Args:
@@ -362,30 +807,43 @@ 

Returns

headers = self.auth return requester.call('DELETE', url, headers=headers)
-
-
-
-def get(self, endpoint, context) -
-
-

Sends GET requests to Ford

-

Args

-
-
endpoint : str
-
the Ford endpoint of interest
-
context : str
-
the API endpoint context
-
-

Returns

-
-
Response
-
response from the request to the Ford API
-
-
- -Expand source code - -
def get(self, endpoint, context):
+                  
+
+
+ + def get(self, endpoint, context) + +
+
+
+

Sends GET requests to Ford

+

Args

+
+
+ endpoint : str +
+
the Ford endpoint of interest
+
+ context : str +
+
the API endpoint context
+
+

Returns

+
+
Response
+
response from the request to the Ford API
+
+
+
+ + Expand source code + +
def get(self, endpoint, context):
     """ Sends GET requests to Ford
     
     Args:
@@ -400,32 +858,49 @@ 

Returns

headers = self.auth return requester.call('GET', url, headers=headers)
-
-
-
-def post(self, endpoint, context, data) -
-
-

Sends POST requests to Ford

-

Args

-
-
endpoint : str
-
the Ford endpoint of interest
-
context : str
-
the API endpoint context
-
data : array
-
data to be sent with request
-
-

Returns

-
-
Response
-
response from the request to the Ford API
-
-
- -Expand source code - -
def post(self, endpoint, context, data):
+                  
+
+
+ + def post(self, endpoint, context, data) + +
+
+
+

Sends POST requests to Ford

+

Args

+
+
+ endpoint : str +
+
the Ford endpoint of interest
+
+ context : str +
+
the API endpoint context
+
+ data : array +
+
data to be sent with request
+
+

Returns

+
+
Response
+
response from the request to the Ford API
+
+
+
+ + Expand source code + +
def post(self, endpoint, context, data):
     """ Sends POST requests to Ford
     
     Args:
@@ -441,32 +916,49 @@ 

Returns

headers = self.auth return requester.call('POST', url, headers=headers, data=data)
-
-
-
-def put(self, endpoint, context, data) -
-
-

Sends PUT requests to Ford

-

Args

-
-
endpoint : str
-
the Ford endpoint of interest
-
context : str
-
the API endpoint context
-
data : array
-
data to be sent with request
-
-

Returns

-
-
Response
-
response from the request to the Ford API
-
-
- -Expand source code - -
def put(self, endpoint, context, data):
+                  
+
+
+ + def put(self, endpoint, context, data) + +
+
+
+

Sends PUT requests to Ford

+

Args

+
+
+ endpoint : str +
+
the Ford endpoint of interest
+
+ context : str +
+
the API endpoint context
+
+ data : array +
+
data to be sent with request
+
+

Returns

+
+
Response
+
response from the request to the Ford API
+
+
+
+ + Expand source code + +
def put(self, endpoint, context, data):
     """ Sends PUT requests to Ford
     
     Args:
@@ -482,43 +974,102 @@ 

Returns

headers = self.auth return requester.call('PUT', url, headers=headers, data=data)
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file +
+ + + + +
+
+ +
+ + + diff --git a/docs/connectedcar.html b/docs/connectedcar.html new file mode 100644 index 0000000..8de0871 --- /dev/null +++ b/docs/connectedcar.html @@ -0,0 +1,876 @@ + + + + + + + connectedcar.connectedcar API documentation + + + + + + + + + + + +
+
+
+

Module connectedcar.connectedcar

+
+
+
+ + Expand source code + +
from . import const, requester
+class AuthClient(object):
+    
+    def __init__(self, client_id, client_secret, redirect_uri=None, scope=None):
+        """ A client for accessing the Ford API
+
+        Args:
+            client_id (str): The application id, provided in the application
+                dashboard
+            client_secret (str): The application secret, provided in the
+                application dashboard
+            redirect_uri (str, optional): The URL to redirect to after the user accepts
+                or declines the application's permissions.
+            scope (list, optional): A list of permissions requested by the application
+
+        """
+        self.client_id = client_id
+        self.client_secret = client_secret
+        self.redirect_uri = redirect_uri
+
+    def get_user_access_token(self, username, password):
+        """ Exchange a username and password for a new access dictionary
+
+        Args:
+            username (str): Ford pass username
+            password (str): Ford pass password
+
+        Returns:
+            Response: response containing access and refresh token
+
+        Raises:
+            SyncException
+        """
+
+        headers = {
+            'Accept': '*/*',
+            'Accept-Language': 'en-US',
+            'Content-Type': 'application/x-www-form-urlencoded',
+            'User-Agent': 'fordpass-na/353 CFNetwork/1121.2.2 Darwin/19.3.0',
+            'Accept-Encoding': 'gzip, deflate, br'
+        }
+
+        data = {
+            'client_id': self.client_id,
+            'grant_type': 'password',
+            'username': username,
+            'password': password
+        }
+
+        response = requester.call('POST', const.TOKEN_URL, headers=headers, data=data).json()
+        return response
+
+    def exchange_refresh_token(self, refresh_token):
+        """ Exchange a refresh token for a new access dictionary
+
+        Args:
+            refresh_token (str): A valid refresh token from a previously retrieved
+                access object
+
+        Returns:
+            Response: response containing access and refresh token
+
+        Raises:
+            SyncException
+        """
+
+        headers = {
+            'Accept': '*/*',
+            'Accept-Language': 'en-US',
+            'Content-Type': 'application/x-www-form-urlencoded',
+            'User-Agent': 'fordpass-na/353 CFNetwork/1121.2.2 Darwin/19.3.0',
+            'Accept-Encoding': 'gzip, deflate, br'
+        }
+
+        data = {
+            'client_id': self.client_id,
+            'grant_type': 'refresh_token',
+            'refresh_token': refresh_token
+        }
+
+        response = requester.call('POST', const.TOKEN_URL, headers=headers, data=data).json()
+        return response
+
+
+
+
+
+
+

Classes

+
+
+ + class AuthClient + (client_id, client_secret, redirect_uri=None, + scope=None) + +
+
+
+

A client for accessing the Ford API

+

Args

+
+
+ client_id : str +
+
+ The application id, provided in the application dashboard +
+
+ client_secret : str +
+
+ The application secret, provided in the application + dashboard +
+
+ redirect_uri + : str, optional +
+
+ The URL to redirect to after the user accepts or declines + the application's permissions. +
+
+ scope + : list, optional +
+
A list of permissions requested by the application
+
+
+
+ + Expand source code + +
class AuthClient(object):
+    
+    def __init__(self, client_id, client_secret, redirect_uri=None, scope=None):
+        """ A client for accessing the Ford API
+
+        Args:
+            client_id (str): The application id, provided in the application
+                dashboard
+            client_secret (str): The application secret, provided in the
+                application dashboard
+            redirect_uri (str, optional): The URL to redirect to after the user accepts
+                or declines the application's permissions.
+            scope (list, optional): A list of permissions requested by the application
+
+        """
+        self.client_id = client_id
+        self.client_secret = client_secret
+        self.redirect_uri = redirect_uri
+
+    def get_user_access_token(self, username, password):
+        """ Exchange a username and password for a new access dictionary
+
+        Args:
+            username (str): Ford pass username
+            password (str): Ford pass password
+
+        Returns:
+            Response: response containing access and refresh token
+
+        Raises:
+            SyncException
+        """
+
+        headers = {
+            'Accept': '*/*',
+            'Accept-Language': 'en-US',
+            'Content-Type': 'application/x-www-form-urlencoded',
+            'User-Agent': 'fordpass-na/353 CFNetwork/1121.2.2 Darwin/19.3.0',
+            'Accept-Encoding': 'gzip, deflate, br'
+        }
+
+        data = {
+            'client_id': self.client_id,
+            'grant_type': 'password',
+            'username': username,
+            'password': password
+        }
+
+        response = requester.call('POST', const.TOKEN_URL, headers=headers, data=data).json()
+        return response
+
+    def exchange_refresh_token(self, refresh_token):
+        """ Exchange a refresh token for a new access dictionary
+
+        Args:
+            refresh_token (str): A valid refresh token from a previously retrieved
+                access object
+
+        Returns:
+            Response: response containing access and refresh token
+
+        Raises:
+            SyncException
+        """
+
+        headers = {
+            'Accept': '*/*',
+            'Accept-Language': 'en-US',
+            'Content-Type': 'application/x-www-form-urlencoded',
+            'User-Agent': 'fordpass-na/353 CFNetwork/1121.2.2 Darwin/19.3.0',
+            'Accept-Encoding': 'gzip, deflate, br'
+        }
+
+        data = {
+            'client_id': self.client_id,
+            'grant_type': 'refresh_token',
+            'refresh_token': refresh_token
+        }
+
+        response = requester.call('POST', const.TOKEN_URL, headers=headers, data=data).json()
+        return response
+
+

Methods

+
+
+ + def + exchange_refresh_token(self, refresh_token) + +
+
+
+

Exchange a refresh token for a new access dictionary

+

Args

+
+
+ refresh_token : str +
+
+ A valid refresh token from a previously retrieved access + object +
+
+

Returns

+
+
Response
+
response containing access and refresh token
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def exchange_refresh_token(self, refresh_token):
+    """ Exchange a refresh token for a new access dictionary
+
+    Args:
+        refresh_token (str): A valid refresh token from a previously retrieved
+            access object
+
+    Returns:
+        Response: response containing access and refresh token
+
+    Raises:
+        SyncException
+    """
+
+    headers = {
+        'Accept': '*/*',
+        'Accept-Language': 'en-US',
+        'Content-Type': 'application/x-www-form-urlencoded',
+        'User-Agent': 'fordpass-na/353 CFNetwork/1121.2.2 Darwin/19.3.0',
+        'Accept-Encoding': 'gzip, deflate, br'
+    }
+
+    data = {
+        'client_id': self.client_id,
+        'grant_type': 'refresh_token',
+        'refresh_token': refresh_token
+    }
+
+    response = requester.call('POST', const.TOKEN_URL, headers=headers, data=data).json()
+    return response
+
+
+
+ + def + get_user_access_token(self, username, password) + +
+
+
+

+ Exchange a username and password for a new access + dictionary +

+

Args

+
+
+ username : str +
+
Ford pass username
+
+ password : str +
+
Ford pass password
+
+

Returns

+
+
Response
+
response containing access and refresh token
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def get_user_access_token(self, username, password):
+    """ Exchange a username and password for a new access dictionary
+
+    Args:
+        username (str): Ford pass username
+        password (str): Ford pass password
+
+    Returns:
+        Response: response containing access and refresh token
+
+    Raises:
+        SyncException
+    """
+
+    headers = {
+        'Accept': '*/*',
+        'Accept-Language': 'en-US',
+        'Content-Type': 'application/x-www-form-urlencoded',
+        'User-Agent': 'fordpass-na/353 CFNetwork/1121.2.2 Darwin/19.3.0',
+        'Accept-Encoding': 'gzip, deflate, br'
+    }
+
+    data = {
+        'client_id': self.client_id,
+        'grant_type': 'password',
+        'username': username,
+        'password': password
+    }
+
+    response = requester.call('POST', const.TOKEN_URL, headers=headers, data=data).json()
+    return response
+
+
+
+
+
+
+
+ +
+ + + diff --git a/docs/const.html b/docs/const.html index 519c773..82e5830 100644 --- a/docs/const.html +++ b/docs/const.html @@ -1,63 +1,477 @@ - + - - - - -syncconnect.const API documentation - - - - - - - - - - - -
-
-
-

Module syncconnect.const

-
-
-
- -Expand source code - -
API_URL = 'https://usapi.cv.ford.com/api'  # US Connected Vehicle api
+  
+    
+    
+    
+    connectedcar.const API documentation
+    
+    
+    
+    
+    
+    
+    
+    
+    
+  
+  
+    
+
+
+

Module connectedcar.const

+
+
+
+ + Expand source code + +
API_URL = 'https://usapi.cv.ford.com/api'  # US Connected Vehicle api
 VEHICLE_URL = 'https://services.cx.ford.com/api'
 USER_URL = 'https://api.mps.ford.com/api'
 TOKEN_URL = 'https://sso.ci.ford.com/oidc/endpoint/default/token'
 APP_ID = '71A3AD0A-CF46-4CCF-B473-FC7FE5BC4592'
-
-
-
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file +
+
+
+
+
+
+
+ +
+ + + diff --git a/docs/exceptions.html b/docs/exceptions.html index 777146e..08b5d5c 100644 --- a/docs/exceptions.html +++ b/docs/exceptions.html @@ -1,32 +1,440 @@ - + - - - - -syncconnect.exceptions API documentation - - - - - - - - - - - -
-
-
-

Module syncconnect.exceptions

-
-
-
- -Expand source code - -
import requests
+  
+    
+    
+    
+    connectedcar.exceptions API documentation
+    
+    
+    
+    
+    
+    
+    
+    
+    
+  
+  
+    
+
+
+

Module connectedcar.exceptions

+
+
+
+ + Expand source code + +
import requests
 class SyncException(Exception):
 
     def __init__(self, response):
@@ -67,152 +475,226 @@ 

Module syncconnect.exceptions

def __str__(self): return self.message
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class AuthenticationException -(response) -
-
-

Common base class for all non-exit exceptions.

-
- -Expand source code - -
class AuthenticationException(SyncException):
+          
+
+
+
+
+
+

Classes

+
+
+ + class + AuthenticationException + (response) + +
+
+
+

Common base class for all non-exit exceptions.

+
+
+ + Expand source code + +
class AuthenticationException(SyncException):
     pass
-
-

Ancestors

- -
-
-class GatewayTimeoutException -(response) -
-
-

Common base class for all non-exit exceptions.

-
- -Expand source code - -
class GatewayTimeoutException(SyncException):
+              
+

Ancestors

+
    +
  • + SyncException +
  • +
  • builtins.Exception
  • +
  • builtins.BaseException
  • +
+
+
+ + class + GatewayTimeoutException + (response) + +
+
+
+

Common base class for all non-exit exceptions.

+
+
+ + Expand source code + +
class GatewayTimeoutException(SyncException):
     def __init__(self, response):
         self.message = response.text
 
     def __str__(self):
         return self.message
-
-

Ancestors

- -
-
-class PermissionException -(response) -
-
-

Common base class for all non-exit exceptions.

-
- -Expand source code - -
class PermissionException(SyncException):
+              
+

Ancestors

+
    +
  • + SyncException +
  • +
  • builtins.Exception
  • +
  • builtins.BaseException
  • +
+
+
+ + class PermissionException + (response) + +
+
+
+

Common base class for all non-exit exceptions.

+
+
+ + Expand source code + +
class PermissionException(SyncException):
     pass
-
-

Ancestors

- -
-
-class RateLimitingException -(response) -
-
-

Common base class for all non-exit exceptions.

-
- -Expand source code - -
class RateLimitingException(SyncException):
+              
+

Ancestors

+
    +
  • + SyncException +
  • +
  • builtins.Exception
  • +
  • builtins.BaseException
  • +
+
+
+ + class RateLimitingException + (response) + +
+
+
+

Common base class for all non-exit exceptions.

+
+
+ + Expand source code + +
class RateLimitingException(SyncException):
     pass
-
-

Ancestors

- -
-
-class ResourceNotFoundException -(response) -
-
-

Common base class for all non-exit exceptions.

-
- -Expand source code - -
class ResourceNotFoundException(SyncException):
+              
+

Ancestors

+
    +
  • + SyncException +
  • +
  • builtins.Exception
  • +
  • builtins.BaseException
  • +
+
+
+ + class + ResourceNotFoundException + (response) + +
+
+
+

Common base class for all non-exit exceptions.

+
+
+ + Expand source code + +
class ResourceNotFoundException(SyncException):
     pass
-
-

Ancestors

- -
-
-class ServerException -(response) -
-
-

Common base class for all non-exit exceptions.

-
- -Expand source code - -
class ServerException(SyncException):
+              
+

Ancestors

+
    +
  • + SyncException +
  • +
  • builtins.Exception
  • +
  • builtins.BaseException
  • +
+
+
+ + class ServerException + (response) + +
+
+
+

Common base class for all non-exit exceptions.

+
+
+ + Expand source code + +
class ServerException(SyncException):
     pass
-
-

Ancestors

- -
-
-class SyncException -(response) -
-
-

Common base class for all non-exit exceptions.

-
- -Expand source code - -
class SyncException(Exception):
+              
+

Ancestors

+
    +
  • + SyncException +
  • +
  • builtins.Exception
  • +
  • builtins.BaseException
  • +
+
+
+ + class SyncException + (response) + +
+
+
+

Common base class for all non-exit exceptions.

+
+
+ + Expand source code + +
class SyncException(Exception):
 
     def __init__(self, response):
         self.message = 'Unknown error'
@@ -227,90 +709,219 @@ 

Ancestors

def __str__(self): return self.message
-
-

Ancestors

-
    -
  • builtins.Exception
  • -
  • builtins.BaseException
  • -
-

Subclasses

- -
-
-class ValidationException -(response) -
-
-

Common base class for all non-exit exceptions.

-
- -Expand source code - -
class ValidationException(SyncException):
+              
+

Ancestors

+
    +
  • builtins.Exception
  • +
  • builtins.BaseException
  • +
+

Subclasses

+ +
+
+ + class ValidationException + (response) + +
+
+
+

Common base class for all non-exit exceptions.

+
+
+ + Expand source code + +
class ValidationException(SyncException):
     pass
-
-

Ancestors

- -
-
-
-
- -
- - - \ No newline at end of file +
+

Ancestors

+
    +
  • + SyncException +
  • +
  • builtins.Exception
  • +
  • builtins.BaseException
  • +
+ + +
+
+ +
+ + + diff --git a/docs/index.html b/docs/index.html index 189f9ca..15d07b0 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,47 +1,466 @@ - + - - - - -syncconnect API documentation - + + + connectedcar API documentation + - - - - - - - - - - -
-
-
-

Package syncconnect

-
-
-

The Python package syncconnect.syncconnect provides a SDK to interact with -Ford Sync Connect enabled vehicles. With this package you will -be able to make requests on behalf of a Ford Pass user to: authorize -new vehicles, edit current vehicles, return vehicle information, send -vehicle commands and return user information.

-
- -Expand source code - -
"""
-The Python package `syncconnect` provides a SDK to interact with
+be able to make …"
+    />
+    
+    
+    
+    
+    
+    
+    
+    
+  
+  
+    
+
+
+

Package connectedcar

+
+
+

+ The Python package + connectedcar.connectedcar + provides a SDK to interact with Ford Sync Connect enabled vehicles. + With this package you will be able to make requests on behalf of a + Ford Pass user to: authorize new vehicles, edit current vehicles, + return vehicle information, send vehicle commands and return user + information. +

+
+ + Expand source code + +
"""
+The Python package `connectedcar` provides a SDK to interact with
 Ford Sync Connect enabled vehicles. With this package you will
 be able to make requests on behalf of a Ford Pass user to: authorize
 new vehicles, edit current vehicles, return vehicle information, send 
 vehicle commands and return user information.
 """
 
-from .syncconnect import (AuthClient)
+from .connectedcar import (AuthClient)
 from .user import User
 from .vehicle import Vehicle
 from .exceptions import (
@@ -53,70 +472,155 @@ 

Package syncconnect

RateLimitingException, ServerException, GatewayTimeoutException)
-
-
-
-

Sub-modules

-
-
syncconnect.api
-
-
-
-
syncconnect.const
-
-
-
-
syncconnect.exceptions
-
-
-
-
syncconnect.requester
-
-
-
-
syncconnect.syncconnect
-
-
-
-
syncconnect.user
-
-
-
-
syncconnect.vehicle
-
-
-
-
-
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file +
+
+
+

Sub-modules

+
+
+ connectedcar.api +
+
+
+
+
+ connectedcar.const +
+
+
+
+
+ connectedcar.exceptions +
+
+
+
+
+ connectedcar.requester +
+
+
+
+
+ connectedcar.connectedcar +
+
+
+
+
+ connectedcar.user +
+
+
+
+
+ connectedcar.vehicle +
+
+
+
+
+
+
+
+
+
+ +
+ + + diff --git a/docs/requester.html b/docs/requester.html index 63af7d8..f81f5fa 100644 --- a/docs/requester.html +++ b/docs/requester.html @@ -1,32 +1,440 @@ - + - - - - -syncconnect.requester API documentation - - - - - - - - - - - -
-
-
-

Module syncconnect.requester

-
-
-
- -Expand source code - -
import requests
+  
+    
+    
+    
+    connectedcar.requester API documentation
+    
+    
+    
+    
+    
+    
+    
+    
+    
+  
+  
+    
+
+
+

Module connectedcar.requester

+
+
+
+ + Expand source code + +
import requests
 from . import exceptions as E
 
 def call(method, url, **kwargs):
@@ -74,40 +482,51 @@ 

Module syncconnect.requester

raise e else: raise E.SyncException("Unexpected error") from e
-
-
-
-
-
-
-
-

Functions

-
-
-def call(method, url, **kwargs) -
-
-

Attachs the kwargs into the headers, sends the request to the Ford API's -and handles all error cases.

-

Args

-
-
method : str
-
HTTP method
-
url : str
-
url of the request
-
**kwargs
-
parameters for the request
-
-

Returns

-
-
Response
-
response from the request to the Ford API's
-
-
- -Expand source code - -
def call(method, url, **kwargs):
+          
+
+
+
+
+

Functions

+
+
+ + def call(method, url, **kwargs) + +
+
+
+

+ Attachs the kwargs into the headers, sends the request to the + Ford API's and handles all error cases. +

+

Args

+
+
+ method : str +
+
HTTP method
+
+ url : str +
+
url of the request
+
+ **kwargs +
+
parameters for the request
+
+

Returns

+
+
Response
+
response from the request to the Ford API's
+
+
+
+ + Expand source code + +
def call(method, url, **kwargs):
     """ Attachs the kwargs into the headers, sends the request to the Ford API's
         and handles all error cases.
 
@@ -152,34 +571,52 @@ 

Returns

raise e else: raise E.SyncException("Unexpected error") from e
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file +
+ + +
+
+
+ +
+ + + diff --git a/docs/syncconnect.html b/docs/syncconnect.html deleted file mode 100644 index fe296dd..0000000 --- a/docs/syncconnect.html +++ /dev/null @@ -1,374 +0,0 @@ - - - - - - -syncconnect.syncconnect API documentation - - - - - - - - - - - -
-
-
-

Module syncconnect.syncconnect

-
-
-
- -Expand source code - -
from . import const, requester
-class AuthClient(object):
-    
-    def __init__(self, client_id, client_secret, redirect_uri=None, scope=None):
-        """ A client for accessing the Ford API
-
-        Args:
-            client_id (str): The application id, provided in the application
-                dashboard
-            client_secret (str): The application secret, provided in the
-                application dashboard
-            redirect_uri (str, optional): The URL to redirect to after the user accepts
-                or declines the application's permissions.
-            scope (list, optional): A list of permissions requested by the application
-
-        """
-        self.client_id = client_id
-        self.client_secret = client_secret
-        self.redirect_uri = redirect_uri
-
-    def get_user_access_token(self, username, password):
-        """ Exchange a username and password for a new access dictionary
-
-        Args:
-            username (str): Ford pass username
-            password (str): Ford pass password
-
-        Returns:
-            Response: response containing access and refresh token
-
-        Raises:
-            SyncException
-        """
-
-        headers = {
-            'Accept': '*/*',
-            'Accept-Language': 'en-US',
-            'Content-Type': 'application/x-www-form-urlencoded',
-            'User-Agent': 'fordpass-na/353 CFNetwork/1121.2.2 Darwin/19.3.0',
-            'Accept-Encoding': 'gzip, deflate, br'
-        }
-
-        data = {
-            'client_id': self.client_id,
-            'grant_type': 'password',
-            'username': username,
-            'password': password
-        }
-
-        response = requester.call('POST', const.TOKEN_URL, headers=headers, data=data).json()
-        return response
-
-    def exchange_refresh_token(self, refresh_token):
-        """ Exchange a refresh token for a new access dictionary
-
-        Args:
-            refresh_token (str): A valid refresh token from a previously retrieved
-                access object
-
-        Returns:
-            Response: response containing access and refresh token
-
-        Raises:
-            SyncException
-        """
-
-        headers = {
-            'Accept': '*/*',
-            'Accept-Language': 'en-US',
-            'Content-Type': 'application/x-www-form-urlencoded',
-            'User-Agent': 'fordpass-na/353 CFNetwork/1121.2.2 Darwin/19.3.0',
-            'Accept-Encoding': 'gzip, deflate, br'
-        }
-
-        data = {
-            'client_id': self.client_id,
-            'grant_type': 'refresh_token',
-            'refresh_token': refresh_token
-        }
-
-        response = requester.call('POST', const.TOKEN_URL, headers=headers, data=data).json()
-        return response
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class AuthClient -(client_id, client_secret, redirect_uri=None, scope=None) -
-
-

A client for accessing the Ford API

-

Args

-
-
client_id : str
-
The application id, provided in the application -dashboard
-
client_secret : str
-
The application secret, provided in the -application dashboard
-
redirect_uri : str, optional
-
The URL to redirect to after the user accepts -or declines the application's permissions.
-
scope : list, optional
-
A list of permissions requested by the application
-
-
- -Expand source code - -
class AuthClient(object):
-    
-    def __init__(self, client_id, client_secret, redirect_uri=None, scope=None):
-        """ A client for accessing the Ford API
-
-        Args:
-            client_id (str): The application id, provided in the application
-                dashboard
-            client_secret (str): The application secret, provided in the
-                application dashboard
-            redirect_uri (str, optional): The URL to redirect to after the user accepts
-                or declines the application's permissions.
-            scope (list, optional): A list of permissions requested by the application
-
-        """
-        self.client_id = client_id
-        self.client_secret = client_secret
-        self.redirect_uri = redirect_uri
-
-    def get_user_access_token(self, username, password):
-        """ Exchange a username and password for a new access dictionary
-
-        Args:
-            username (str): Ford pass username
-            password (str): Ford pass password
-
-        Returns:
-            Response: response containing access and refresh token
-
-        Raises:
-            SyncException
-        """
-
-        headers = {
-            'Accept': '*/*',
-            'Accept-Language': 'en-US',
-            'Content-Type': 'application/x-www-form-urlencoded',
-            'User-Agent': 'fordpass-na/353 CFNetwork/1121.2.2 Darwin/19.3.0',
-            'Accept-Encoding': 'gzip, deflate, br'
-        }
-
-        data = {
-            'client_id': self.client_id,
-            'grant_type': 'password',
-            'username': username,
-            'password': password
-        }
-
-        response = requester.call('POST', const.TOKEN_URL, headers=headers, data=data).json()
-        return response
-
-    def exchange_refresh_token(self, refresh_token):
-        """ Exchange a refresh token for a new access dictionary
-
-        Args:
-            refresh_token (str): A valid refresh token from a previously retrieved
-                access object
-
-        Returns:
-            Response: response containing access and refresh token
-
-        Raises:
-            SyncException
-        """
-
-        headers = {
-            'Accept': '*/*',
-            'Accept-Language': 'en-US',
-            'Content-Type': 'application/x-www-form-urlencoded',
-            'User-Agent': 'fordpass-na/353 CFNetwork/1121.2.2 Darwin/19.3.0',
-            'Accept-Encoding': 'gzip, deflate, br'
-        }
-
-        data = {
-            'client_id': self.client_id,
-            'grant_type': 'refresh_token',
-            'refresh_token': refresh_token
-        }
-
-        response = requester.call('POST', const.TOKEN_URL, headers=headers, data=data).json()
-        return response
-
-

Methods

-
-
-def exchange_refresh_token(self, refresh_token) -
-
-

Exchange a refresh token for a new access dictionary

-

Args

-
-
refresh_token : str
-
A valid refresh token from a previously retrieved -access object
-
-

Returns

-
-
Response
-
response containing access and refresh token
-
-

Raises

-

SyncException

-
- -Expand source code - -
def exchange_refresh_token(self, refresh_token):
-    """ Exchange a refresh token for a new access dictionary
-
-    Args:
-        refresh_token (str): A valid refresh token from a previously retrieved
-            access object
-
-    Returns:
-        Response: response containing access and refresh token
-
-    Raises:
-        SyncException
-    """
-
-    headers = {
-        'Accept': '*/*',
-        'Accept-Language': 'en-US',
-        'Content-Type': 'application/x-www-form-urlencoded',
-        'User-Agent': 'fordpass-na/353 CFNetwork/1121.2.2 Darwin/19.3.0',
-        'Accept-Encoding': 'gzip, deflate, br'
-    }
-
-    data = {
-        'client_id': self.client_id,
-        'grant_type': 'refresh_token',
-        'refresh_token': refresh_token
-    }
-
-    response = requester.call('POST', const.TOKEN_URL, headers=headers, data=data).json()
-    return response
-
-
-
-def get_user_access_token(self, username, password) -
-
-

Exchange a username and password for a new access dictionary

-

Args

-
-
username : str
-
Ford pass username
-
password : str
-
Ford pass password
-
-

Returns

-
-
Response
-
response containing access and refresh token
-
-

Raises

-

SyncException

-
- -Expand source code - -
def get_user_access_token(self, username, password):
-    """ Exchange a username and password for a new access dictionary
-
-    Args:
-        username (str): Ford pass username
-        password (str): Ford pass password
-
-    Returns:
-        Response: response containing access and refresh token
-
-    Raises:
-        SyncException
-    """
-
-    headers = {
-        'Accept': '*/*',
-        'Accept-Language': 'en-US',
-        'Content-Type': 'application/x-www-form-urlencoded',
-        'User-Agent': 'fordpass-na/353 CFNetwork/1121.2.2 Darwin/19.3.0',
-        'Accept-Encoding': 'gzip, deflate, br'
-    }
-
-    data = {
-        'client_id': self.client_id,
-        'grant_type': 'password',
-        'username': username,
-        'password': password
-    }
-
-    response = requester.call('POST', const.TOKEN_URL, headers=headers, data=data).json()
-    return response
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/docs/user.html b/docs/user.html index 9108131..0e8b6cc 100644 --- a/docs/user.html +++ b/docs/user.html @@ -1,32 +1,440 @@ - + - - - - -syncconnect.user API documentation - - - - - - - - - - - -
-
-
-

Module syncconnect.user

-
-
-
- -Expand source code - -
from .api import Api
+  
+    
+    
+    
+    connectedcar.user API documentation
+    
+    
+    
+    
+    
+    
+    
+    
+    
+  
+  
+    
+
+
+

Module connectedcar.user

+
+
+
+ + Expand source code + +
from .api import Api
 from . import const
 
 class User(object):
@@ -91,33 +499,41 @@ 

Module syncconnect.user

return response.json()
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class User -(access_token) -
-
-

Initialize a new User object to directly make requests to Ford.

-

Args

-
-
access_token : str
-
Ford access token
-
-
- -Expand source code - -
class User(object):
+          
+
+
+
+
+
+

Classes

+
+
+ + class User + (access_token) + +
+
+
+

+ Initialize a new User object to directly make requests to + Ford. +

+

Args

+
+
+ access_token : str +
+
Ford access token
+
+
+
+ + Expand source code + +
class User(object):
 
     def __init__(self, access_token):
         """ Initialize a new User object to directly make requests to Ford.
@@ -177,29 +593,38 @@ 

Args

response = self.api.delete(const.API_URL, 'users/vehicles/'+vehicle_id) return response.json()
-
-

Methods

-
-
-def add_vehicle(self, vehicle_id) -
-
-

POST User.add_vehicle

-

Args

-
-
vehicle_id : str
-
the vehicle identification number
-
-

Returns

-
-
Response
-
response from the request to the Ford API
-
-
- -Expand source code - -
def add_vehicle(self, vehicle_id):
+              
+

Methods

+
+
+ + def add_vehicle(self, vehicle_id) + +
+
+
+

POST User.add_vehicle

+

Args

+
+
+ vehicle_id : str +
+
the vehicle identification number
+
+

Returns

+
+
Response
+
response from the request to the Ford API
+
+
+
+ + Expand source code + +
def add_vehicle(self, vehicle_id):
     """ POST User.add_vehicle
 
     Args:
@@ -213,28 +638,37 @@ 

Returns

data = '{"countryCode": "USA", "nickName": "", "vin": "'+vehicle_id+'", "appBrand": "F", "appRegion": "NA"}' response = self.api.post(const.USER_URL, 'garage/mobile', data) return response.json()
-
-
-
-def delete_vehicle(self, vehicle_id) -
-
-

DELETE User.delete_vehicle

-

Args

-
-
vehicle_id : str
-
the vehicle identification number
-
-

Returns

-
-
Response
-
response from the request to the Ford API
-
-
- -Expand source code - -
def delete_vehicle(self, vehicle_id):
+                  
+
+
+ + def delete_vehicle(self, vehicle_id) + +
+
+
+

DELETE User.delete_vehicle

+

Args

+
+
+ vehicle_id : str +
+
the vehicle identification number
+
+

Returns

+
+
Response
+
response from the request to the Ford API
+
+
+
+ + Expand source code + +
def delete_vehicle(self, vehicle_id):
     """ DELETE User.delete_vehicle
 
     Args:
@@ -247,23 +681,28 @@ 

Returns

response = self.api.delete(const.API_URL, 'users/vehicles/'+vehicle_id) return response.json()
-
-
-
-def info(self) -
-
-

GET User.info

-

Returns

-
-
Response
-
User information
-
-
- -Expand source code - -
def info(self):
+                  
+
+
+ + def info(self) + +
+
+
+

GET User.info

+

Returns

+
+
Response
+
User information
+
+
+
+ + Expand source code + +
def info(self):
     """ GET User.info
     
     Returns:
@@ -273,23 +712,28 @@ 

Returns

response = self.api.get(const.API_URL, 'users') return response.json()
-
-
-
-def vehicles(self) -
-
-

GET User.vehicles

-

Returns

-
-
Response
-
User vehicle list
-
-
- -Expand source code - -
def vehicles(self):
+                  
+
+
+ + def vehicles(self) + +
+
+
+

GET User.vehicles

+

Returns

+
+
Response
+
User vehicle list
+
+
+
+ + Expand source code + +
def vehicles(self):
     """ GET User.vehicles
     
     Returns:
@@ -299,42 +743,93 @@ 

Returns

response = self.api.get(const.VEHICLE_URL, 'dashboard/v1/users/vehicles?country=USA&language=EN&region=US&skipRecall=true') return response.json()
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file +
+ + + + +
+
+ +
+ + + diff --git a/docs/vehicle.html b/docs/vehicle.html index 90a6a6f..07a3faf 100644 --- a/docs/vehicle.html +++ b/docs/vehicle.html @@ -1,32 +1,440 @@ - + - - - - -syncconnect.vehicle API documentation - - - - - - - - - - - -
-
-
-

Module syncconnect.vehicle

-
-
-
- -Expand source code - -
from .api import Api
+  
+    
+    
+    
+    connectedcar.vehicle API documentation
+    
+    
+    
+    
+    
+    
+    
+    
+    
+  
+  
+    
+
+
+

Module connectedcar.vehicle

+
+
+
+ + Expand source code + +
from .api import Api
 from . import const
 
 class Vehicle(object):
@@ -395,35 +803,47 @@ 

Module syncconnect.vehicle

job_id = self.api.action('DELETE', const.API_URL, 'vehicles/v2/'+self.vehicle_id+'/doors/lock').json()['commandId'] response = self.api.action('GET', const.API_URL, 'vehicles/'+self.vehicle_id+'/doors/lock/'+job_id) return response.json()
-
-
-
-
-
-
-
-
-
-

Classes

-
-
-class Vehicle -(vehicle_id, access_token) -
-
-

Initialize a new Vehicle object to directly make requests to Ford.

-

Args

-
-
vehicle_id : str
-
Vehicle identification number
-
access_token : str
-
Sync Connect access token
-
-
- -Expand source code - -
class Vehicle(object):
+          
+
+
+
+
+
+

Classes

+
+
+ + class Vehicle + (vehicle_id, access_token) + +
+
+
+

+ Initialize a new Vehicle object to directly make requests to + Ford. +

+

Args

+
+
+ vehicle_id : str +
+
Vehicle identification number
+
+ access_token : str +
+
Sync Connect access token
+
+
+
+ + Expand source code + +
class Vehicle(object):
 
     def __init__(self, vehicle_id, access_token):
         """ Initialize a new Vehicle object to directly make requests to Ford.
@@ -789,26 +1209,31 @@ 

Args

job_id = self.api.action('DELETE', const.API_URL, 'vehicles/v2/'+self.vehicle_id+'/doors/lock').json()['commandId'] response = self.api.action('GET', const.API_URL, 'vehicles/'+self.vehicle_id+'/doors/lock/'+job_id) return response.json()
-
-

Methods

-
-
-def alarm_status(self) -
-
-

GET Vehicle.alarm_status

-

Returns

-
-
Response
-
Vehicle alarm status
-
-

Raises

-

SyncException

-
- -Expand source code - -
def alarm_status(self):
+              
+

Methods

+
+
+ + def alarm_status(self) + +
+
+
+

GET Vehicle.alarm_status

+

Returns

+
+
Response
+
Vehicle alarm status
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def alarm_status(self):
     """ GET Vehicle.alarm_status
     
     Returns:
@@ -821,25 +1246,30 @@ 

Raises

json = self.status() return {"data": json['vehiclestatus']['alarm']}
-
-
-
-def auth_status(self) -
-
-

GET Vehicle.auth_status

-

Returns

-
-
Response
-
Vehicle authorization status
-
-

Raises

-

SyncException

-
- -Expand source code - -
def auth_status(self):
+                  
+
+
+ + def auth_status(self) + +
+
+
+

GET Vehicle.auth_status

+

Returns

+
+
Response
+
Vehicle authorization status
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def auth_status(self):
     """ GET Vehicle.auth_status
     
     Returns:
@@ -852,25 +1282,30 @@ 

Raises

response = self.api.get(const.API_URL, 'vehicles/'+self.vehicle_id+'/authstatus?lrdt=01-01-1970%2000:00:00') return response.json()
-
-
-
-def battery(self) -
-
-

GET Vehicle.battery

-

Returns

-
-
Response
-
Vehicle battery status
-
-

Raises

-

SyncException

-
- -Expand source code - -
def battery(self):
+                  
+
+
+ + def battery(self) + +
+
+
+

GET Vehicle.battery

+

Returns

+
+
Response
+
Vehicle battery status
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def battery(self):
     """ GET Vehicle.battery
     
     Returns:
@@ -883,25 +1318,30 @@ 

Raises

json = self.status() return {"data": json['vehiclestatus']['battery']}
-
-
-
-def capability(self) -
-
-

GET Vehicle.capability

-

Returns

-
-
Response
-
Vehicle capabilities
-
-

Raises

-

SyncException

-
- -Expand source code - -
def capability(self):
+                  
+
+
+ + def capability(self) + +
+
+
+

GET Vehicle.capability

+

Returns

+
+
Response
+
Vehicle capabilities
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def capability(self):
     """ GET Vehicle.capability
     
     Returns:
@@ -914,25 +1354,30 @@ 

Raises

response = self.api.get(const.API_URL, 'capability/v1/vehicles/'+self.vehicle_id) return response.json()
-
-
-
-def details(self) -
-
-

GET Vehicle.detials

-

Returns

-
-
Response
-
Vehicle details
-
-

Raises

-

SyncException

-
- -Expand source code - -
def details(self):
+                  
+
+
+ + def details(self) + +
+
+
+

GET Vehicle.detials

+

Returns

+
+
Response
+
Vehicle details
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def details(self):
     """ GET Vehicle.detials
     
     Returns:
@@ -945,25 +1390,30 @@ 

Raises

response = self.api.get(const.API_URL, 'users/vehicles/'+self.vehicle_id+'/detail?lrdt=01-01-1970%2000:00:00') return response.json()
-
-
-
-def door_status(self) -
-
-

GET Vehicle.door_status

-

Returns

-
-
Response
-
Vehicle doors status
-
-

Raises

-

SyncException

-
- -Expand source code - -
def door_status(self):
+                  
+
+
+ + def door_status(self) + +
+
+
+

GET Vehicle.door_status

+

Returns

+
+
Response
+
Vehicle doors status
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def door_status(self):
     """ GET Vehicle.door_status
     
     Returns:
@@ -976,25 +1426,30 @@ 

Raises

json = self.status() return {"data": json['vehiclestatus']['doorStatus']}
-
-
-
-def fuel(self) -
-
-

GET Vehicle.fuel

-

Returns

-
-
Response
-
Vehicle fuel level
-
-

Raises

-

SyncException

-
- -Expand source code - -
def fuel(self):
+                  
+
+
+ + def fuel(self) + +
+
+
+

GET Vehicle.fuel

+

Returns

+
+
Response
+
Vehicle fuel level
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def fuel(self):
     """ GET Vehicle.fuel
     
     Returns:
@@ -1007,25 +1462,30 @@ 

Raises

json = self.status() return {"data": json['vehiclestatus']['fuel']}
-
-
-
-def ignition_status(self) -
-
-

GET Vehicle.ignition_status

-

Returns

-
-
Response
-
Vehicle ignition status
-
-

Raises

-

SyncException

-
- -Expand source code - -
def ignition_status(self):
+                  
+
+
+ + def ignition_status(self) + +
+
+
+

GET Vehicle.ignition_status

+

Returns

+
+
Response
+
Vehicle ignition status
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def ignition_status(self):
     """ GET Vehicle.ignition_status
     
     Returns:
@@ -1038,25 +1498,30 @@ 

Raises

json = self.status() return {"data": json['vehiclestatus']['ignitionStatus']}
-
-
-
-def info(self) -
-
-

GET Vehicle.info

-

Returns

-
-
Response
-
Vehicle information
-
-

Raises

-

SyncException

-
- -Expand source code - -
def info(self):
+                  
+
+
+ + def info(self) + +
+
+
+

GET Vehicle.info

+

Returns

+
+
Response
+
Vehicle information
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def info(self):
     """ GET Vehicle.info
     
     Returns:
@@ -1069,25 +1534,30 @@ 

Raises

response = self.api.get(const.VEHICLE_URL, 'vinlookup/v1/vins/'+self.vehicle_id+'/detail?country=USA&language=EN') return response.json()
-
-
-
-def location(self) -
-
-

GET Vehicle.location

-

Returns

-
-
Response
-
Vehicle location
-
-

Raises

-

SyncException

-
- -Expand source code - -
def location(self):
+                  
+
+
+ + def location(self) + +
+
+
+

GET Vehicle.location

+

Returns

+
+
Response
+
Vehicle location
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def location(self):
     """ GET Vehicle.location
     
     Returns:
@@ -1100,25 +1570,30 @@ 

Raises

json = self.status() return {"data": json['vehiclestatus']['gps']}
-
-
-
-def lock(self) -
-
-

PUT/GET Vehicle.lock

-

Returns

-
-
Response
-
response from the request to the Ford API
-
-

Raises

-

SyncException

-
- -Expand source code - -
def lock(self):
+                  
+
+
+ + def lock(self) + +
+
+
+

PUT/GET Vehicle.lock

+

Returns

+
+
Response
+
response from the request to the Ford API
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def lock(self):
     """ PUT/GET Vehicle.lock
     
     Returns:
@@ -1132,25 +1607,30 @@ 

Raises

job_id = self.api.action('PUT', const.API_URL, 'vehicles/v2/'+self.vehicle_id+'/doors/lock').json()['commandId'] response = self.api.action('GET', const.API_URL, 'vehicles/'+self.vehicle_id+'/doors/lock/'+job_id) return response.json()
-
-
-
-def lock_status(self) -
-
-

GET Vehicle.lock_Status

-

Returns

-
-
Response
-
Vehicle lock status
-
-

Raises

-

SyncException

-
- -Expand source code - -
def lock_status(self):
+                  
+
+
+ + def lock_status(self) + +
+
+
+

GET Vehicle.lock_Status

+

Returns

+
+
Response
+
Vehicle lock status
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def lock_status(self):
     """ GET Vehicle.lock_Status
     
     Returns:
@@ -1163,25 +1643,31 @@ 

Raises

json = self.status() return {"data": json['vehiclestatus']['lockStatus']}
-
-
-
-def maintenance_schedule(self) -
-
-

GET Vehicle.maintenance_schedule

-

Returns

-
-
Response
-
Vehicle maintenance schedule
-
-

Raises

-

SyncException

-
- -Expand source code - -
def maintenance_schedule(self):
+                  
+
+
+ + def maintenance_schedule(self) + +
+
+
+

GET Vehicle.maintenance_schedule

+

Returns

+
+
Response
+
Vehicle maintenance schedule
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def maintenance_schedule(self):
     """ GET Vehicle.maintenance_schedule
     
     Returns:
@@ -1194,25 +1680,30 @@ 

Raises

response = self.api.get(const.API_URL, 'vehiclemaintenance/v1/maintenance-schedule?vin='+self.vehicle_id+'&language=EN&country=USA') return response.json()
-
-
-
-def odometer(self) -
-
-

GET Vehicle.odometer

-

Returns

-
-
Response
-
Vehicle odometer
-
-

Raises

-

SyncException

-
- -Expand source code - -
def odometer(self):
+                  
+
+
+ + def odometer(self) + +
+
+
+

GET Vehicle.odometer

+

Returns

+
+
Response
+
Vehicle odometer
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def odometer(self):
     """ GET Vehicle.odometer
     
     Returns:
@@ -1225,25 +1716,30 @@ 

Raises

json = self.status() return {"data": json['vehiclestatus']['odometer']}
-
-
-
-def oil(self) -
-
-

GET Vehicle.oil

-

Returns

-
-
Response
-
Vehicle oil life
-
-

Raises

-

SyncException

-
- -Expand source code - -
def oil(self):
+                  
+
+
+ + def oil(self) + +
+
+
+

GET Vehicle.oil

+

Returns

+
+
Response
+
Vehicle oil life
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def oil(self):
     """ GET Vehicle.oil
     
     Returns:
@@ -1256,25 +1752,30 @@ 

Raises

json = self.status() return {"data": json['vehiclestatus']['oil']}
-
-
-
-def refresh_status(self) -
-
-

GET Vehicle.refresh_status

-

Returns

-
-
Response
-
Refresh vehicle status
-
-

Raises

-

SyncException

-
- -Expand source code - -
def refresh_status(self):
+                  
+
+
+ + def refresh_status(self) + +
+
+
+

GET Vehicle.refresh_status

+

Returns

+
+
Response
+
Refresh vehicle status
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def refresh_status(self):
     """ GET Vehicle.refresh_status
     
     Returns:
@@ -1287,25 +1788,30 @@ 

Raises

response = self.api.get(const.API_URL, 'vehicles/v3/'+self.vehicle_id+'/statusrefresh/ffe168a3-657f-4b74-9668-909c60e2379f') return response.json()
-
-
-
-def send_auth(self) -
-
-

POST Vehicle.send_auth

-

Returns

-
-
Response
-
Send vehicle authorization
-
-

Raises

-

SyncException

-
- -Expand source code - -
def send_auth(self):
+                  
+
+
+ + def send_auth(self) + +
+
+
+

POST Vehicle.send_auth

+

Returns

+
+
Response
+
Send vehicle authorization
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def send_auth(self):
     """ POST Vehicle.send_auth
     
     Returns:
@@ -1318,25 +1824,30 @@ 

Raises

response = self.api.post(const.API_URL, 'vehicles/v2/'+self.vehicle_id+'/drivers', None) return response.json()
-
-
-
-def start(self) -
-
-

PUT/GET Vehicle.start

-

Returns

-
-
Response
-
response from the request to the Ford API
-
-

Raises

-

SyncException

-
- -Expand source code - -
def start(self):
+                  
+
+
+ + def start(self) + +
+
+
+

PUT/GET Vehicle.start

+

Returns

+
+
Response
+
response from the request to the Ford API
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def start(self):
     """ PUT/GET Vehicle.start
     
     Returns:
@@ -1350,25 +1861,30 @@ 

Raises

job_id = self.api.action('PUT', const.API_URL, 'vehicles/v2/'+self.vehicle_id+'/engine/start').json()['commandId'] response = self.api.action('GET', const.API_URL, 'vehicles/'+self.vehicle_id+'/engine/start/'+job_id) return response.json()
-
-
-
-def status(self) -
-
-

GET Vehicle.status

-

Returns

-
-
Response
-
Current vehicle status
-
-

Raises

-

SyncException

-
- -Expand source code - -
def status(self):
+                  
+
+
+ + def status(self) + +
+
+
+

GET Vehicle.status

+

Returns

+
+
Response
+
Current vehicle status
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def status(self):
     """ GET Vehicle.status
     
     Returns:
@@ -1381,25 +1897,30 @@ 

Raises

response = self.api.get(const.API_URL, 'vehicles/v4/'+self.vehicle_id+'/status?lrdt=01-01-1970%2000:00:00') return response.json()
-
-
-
-def stop(self) -
-
-

DELETE/GET Vehicle.stop

-

Returns

-
-
Response
-
response from the request to the Ford API
-
-

Raises

-

SyncException

-
- -Expand source code - -
def stop(self):
+                  
+
+
+ + def stop(self) + +
+
+
+

DELETE/GET Vehicle.stop

+

Returns

+
+
Response
+
response from the request to the Ford API
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def stop(self):
     """ DELETE/GET Vehicle.stop
     
     Returns:
@@ -1413,25 +1934,30 @@ 

Raises

job_id = self.api.action('DELETE', const.API_URL, 'vehicles/v2/'+self.vehicle_id+'/engine/start').json()['commandId'] response = self.api.action('GET', const.API_URL, 'vehicles/'+self.vehicle_id+'/engine/start/'+job_id) return response.json()
-
-
-
-def tire_pressure(self) -
-
-

GET Vehicle.tire_pressure

-

Returns

-
-
Response
-
Vehicle tire pressure
-
-

Raises

-

SyncException

-
- -Expand source code - -
def tire_pressure(self):
+                  
+
+
+ + def tire_pressure(self) + +
+
+
+

GET Vehicle.tire_pressure

+

Returns

+
+
Response
+
Vehicle tire pressure
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def tire_pressure(self):
     """ GET Vehicle.tire_pressure
     
     Returns:
@@ -1444,25 +1970,30 @@ 

Raises

json = self.status() return {"data": json['vehiclestatus']['TPMS']}
-
-
-
-def unlock(self) -
-
-

DELETE/GET Vehicle.unlock

-

Returns

-
-
Response
-
response from the request to the Ford API
-
-

Raises

-

SyncException

-
- -Expand source code - -
def unlock(self):
+                  
+
+
+ + def unlock(self) + +
+
+
+

DELETE/GET Vehicle.unlock

+

Returns

+
+
Response
+
response from the request to the Ford API
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def unlock(self):
     """ DELETE/GET Vehicle.unlock
     
     Returns:
@@ -1476,25 +2007,30 @@ 

Raises

job_id = self.api.action('DELETE', const.API_URL, 'vehicles/v2/'+self.vehicle_id+'/doors/lock').json()['commandId'] response = self.api.action('GET', const.API_URL, 'vehicles/'+self.vehicle_id+'/doors/lock/'+job_id) return response.json()
-
-
-
-def vin(self) -
-
-

GET Vehicle.vin

-

Returns

-
-
Response
-
Vehicle vin
-
-

Raises

-

SyncException

-
- -Expand source code - -
def vin(self):
+                  
+
+
+ + def vin(self) + +
+
+
+

GET Vehicle.vin

+

Returns

+
+
Response
+
Vehicle vin
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def vin(self):
     """ GET Vehicle.vin
     
     Returns:
@@ -1507,25 +2043,30 @@ 

Raises

json = self.status() return {"data": json['vehiclestatus']['vin']}
-
-
-
-def wakeup(self) -
-
-

GET Vehicle.wakeup

-

Returns

-
-
Response
-
response from the request to the Ford API
-
-

Raises

-

SyncException

-
- -Expand source code - -
def wakeup(self):
+                  
+
+
+ + def wakeup(self) + +
+
+
+

GET Vehicle.wakeup

+

Returns

+
+
Response
+
response from the request to the Ford API
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def wakeup(self):
     """ GET Vehicle.wakeup
     
     Returns:
@@ -1538,25 +2079,30 @@ 

Raises

response = self.api.action('GET', const.USER_URL, 'dashboard/v1/users/vehicles?language=EN&wakeupVin='+self.vehicle_id+'&skipRecall=true&country=USA&region=US') return response.json()
-
-
-
-def window_positions(self) -
-
-

GET Vehicle.window_position

-

Returns

-
-
Response
-
Vehicle window positions
-
-

Raises

-

SyncException

-
- -Expand source code - -
def window_positions(self):
+                  
+
+
+ + def window_positions(self) + +
+
+
+

GET Vehicle.window_position

+

Returns

+
+
Response
+
Vehicle window positions
+
+

Raises

+

SyncException

+
+
+ + Expand source code + +
def window_positions(self):
     """ GET Vehicle.window_position
     
     Returns:
@@ -1569,63 +2115,282 @@ 

Raises

json = self.status() return {"data": json['vehiclestatus']['windowPosition']}
-
-
-
-
-
-
-
- -
- - - \ No newline at end of file +
+ + + + +
+
+ +
+ + + diff --git a/examples/start-vehicle.py b/examples/start-vehicle.py index a2b0986..50ca3d1 100644 --- a/examples/start-vehicle.py +++ b/examples/start-vehicle.py @@ -1,13 +1,13 @@ -import syncconnect +import connectedcar -client = syncconnect.AuthClient( +client = connectedcar.AuthClient( '9fb503e0-715b-47e8-adfd-ad4b7770f73b', None, None) # Create client connection access = client.get_user_access_token( '', '') # Fetch client access token -user = syncconnect.User(access['access_token']) # New User Object +user = connectedcar.User(access['access_token']) # New User Object vehicles = user.vehicles() # Fetch list of user vehicles vehicleList = [] # Stored list of user vehicles @@ -16,6 +16,6 @@ vehicleList.insert(0, userVehicle['vin']) break -currentVehicle = syncconnect.Vehicle( +currentVehicle = connectedcar.Vehicle( vehicleList[0], access['access_token']) # Create vehicle object print(currentVehicle.start()) # Send start command diff --git a/examples/vehicle-info.py b/examples/vehicle-info.py index 7b22e7a..9adf91e 100644 --- a/examples/vehicle-info.py +++ b/examples/vehicle-info.py @@ -1,16 +1,16 @@ -import syncconnect +import connectedcar -client = syncconnect.AuthClient( +client = connectedcar.AuthClient( '9fb503e0-715b-47e8-adfd-ad4b7770f73b', None, None) # Create client connection access = client.get_user_access_token( '', '') # Fetch client access token -user = syncconnect.User(access['access_token']) # New User Object +user = connectedcar.User(access['access_token']) # New User Object vehicles = user.vehicles() # Fetch list of user vehicles for userVehicle in vehicles: # For each user vehicle - vehicle = syncconnect.Vehicle( + vehicle = connectedcar.Vehicle( userVehicle['vin'], access['access_token']) # Create vehicle object print(vehicle.info()) # Return vehicle info diff --git a/setup.py b/setup.py index b6a52f4..3da1fe9 100644 --- a/setup.py +++ b/setup.py @@ -53,15 +53,15 @@ def _get_long_description(): setup( - name='syncconnect', + name='connectedcar', version=_get_version(), - description='Sync Connect Python SDK', + description='ConnectedCar SDK', long_description=_get_long_description(), long_description_content_type='text/markdown', author='Ian White', - author_email='ianjwhite99@gmail.com', - packages=['syncconnect'], - url='https://github.com/ianjwhite99/sync-connect-sdk', + author_email='iwhite99@protonmail.com', + packages=['connectedcar'], + url='https://github.com/ianjwhite99/connected-car-python-sdk', license='MIT', install_requires=[ 'requests' diff --git a/tests/unit/test_api.py b/tests/unit/test_api.py index d42fcbd..8fc9e29 100644 --- a/tests/unit/test_api.py +++ b/tests/unit/test_api.py @@ -1,4 +1,4 @@ -from syncconnect import api, const +from connectedcar import api, const import unittest diff --git a/tests/unit/test_requester.py b/tests/unit/test_requester.py index f71af95..5fa482e 100644 --- a/tests/unit/test_requester.py +++ b/tests/unit/test_requester.py @@ -1,4 +1,4 @@ -import syncconnect +import connectedcar import responses import unittest @@ -22,14 +22,14 @@ def check(self, exception): self.assertRaisesRegexp( exception, self.EXPECTED, - syncconnect.requester.call, + connectedcar.requester.call, 'GET', self.URL) @responses.activate def test_user_agent(self): self.queue(200) - syncconnect.requester.call('GET', self.URL) + connectedcar.requester.call('GET', self.URL) self.assertEqual( responses.calls[0].request.headers['User-Agent'], 'fordpass-na/353 CFNetwork/1121.2.2 Darwin/19.3.0', @@ -39,62 +39,62 @@ def test_user_agent(self): def test_oauth_error(self): self.queue(401, error_description='unauthorized') try: - syncconnect.requester.call('GET', self.URL) - except syncconnect.AuthenticationException as err: + connectedcar.requester.call('GET', self.URL) + except connectedcar.AuthenticationException as err: self.assertEqual(err.message, 'unauthorized') @responses.activate def test_unknown_error(self): self.queue(401, error_description='unknown error') try: - syncconnect.requester.call('GET', self.URL) - except syncconnect.AuthenticationException as err: + connectedcar.requester.call('GET', self.URL) + except connectedcar.AuthenticationException as err: self.assertEqual(err.message, 'unknown error') @responses.activate def test_400(self): self.queue(400) - self.check(syncconnect.ValidationException) + self.check(connectedcar.ValidationException) @responses.activate def test_401(self): self.queue(401) - self.check(syncconnect.AuthenticationException) + self.check(connectedcar.AuthenticationException) @responses.activate def test_403(self): self.queue(403) - self.check(syncconnect.PermissionException) + self.check(connectedcar.PermissionException) @responses.activate def test_404(self): self.queue(404) - self.check(syncconnect.ResourceNotFoundException) + self.check(connectedcar.ResourceNotFoundException) @responses.activate def test_429(self): self.queue(429) - self.check(syncconnect.RateLimitingException) + self.check(connectedcar.RateLimitingException) @responses.activate def test_429(self): self.queue(429) - self.check(syncconnect.RateLimitingException) + self.check(connectedcar.RateLimitingException) @responses.activate def test_500(self): self.queue(500) - self.check(syncconnect.ServerException) + self.check(connectedcar.ServerException) @responses.activate def test_504(self): responses.add('GET', self.URL, status=504, json={ 'error': 'some error', 'message': self.EXPECTED}) - self.check(syncconnect.GatewayTimeoutException) + self.check(connectedcar.GatewayTimeoutException) @responses.activate def test_other(self): self.queue(503) - with self.assertRaises(syncconnect.SyncException) as se: - syncconnect.requester.call('GET', self.URL) + with self.assertRaises(connectedcar.SyncException) as se: + connectedcar.requester.call('GET', self.URL) self.assertEquals(se.exception.message, 'Unexpected error') diff --git a/tests/unit/test_syncconnect.py b/tests/unit/test_syncconnect.py index 754baa8..e09e2ea 100644 --- a/tests/unit/test_syncconnect.py +++ b/tests/unit/test_syncconnect.py @@ -1,9 +1,9 @@ import unittest import responses -from syncconnect import syncconnect, const +from connectedcar import connectedcar, const -class TestSyncConnect(unittest.TestCase): +class Testconnectedcar(unittest.TestCase): def setUp(self): self.client_id = 'apiKey' @@ -11,7 +11,7 @@ def setUp(self): self.redirect_uri = "redirectUri" self.scope = ['profile'] - self.client = syncconnect.AuthClient( + self.client = connectedcar.AuthClient( self.client_id, self.client_secret, self.redirect_uri, self.scope) @responses.activate diff --git a/tests/unit/test_user.py b/tests/unit/test_user.py index 2c05a99..a1fd61f 100644 --- a/tests/unit/test_user.py +++ b/tests/unit/test_user.py @@ -1,13 +1,13 @@ import unittest import responses -import syncconnect -from syncconnect import const +import connectedcar +from connectedcar import const class TestUser(unittest.TestCase): def setUp(self): - self.user = syncconnect.User('access_token') + self.user = connectedcar.User('access_token') @responses.activate def test_get_user_info(self): diff --git a/tests/unit/test_vehicle.py b/tests/unit/test_vehicle.py index 7386c64..f416329 100644 --- a/tests/unit/test_vehicle.py +++ b/tests/unit/test_vehicle.py @@ -1,14 +1,14 @@ import unittest import responses -import syncconnect -from syncconnect import const +import connectedcar +from connectedcar import const class TestVehicle(unittest.TestCase): def setUp(self): self.vin = '1FTEW1EP6KKC17890' - self.vehicle = syncconnect.Vehicle(self.vin, 'access_token') + self.vehicle = connectedcar.Vehicle(self.vin, 'access_token') @responses.activate def test_get_vehicle_info(self):