Skip to content

Commit

Permalink
Minor version incremented
Browse files Browse the repository at this point in the history
  • Loading branch information
tdorssers committed Jun 6, 2022
1 parent 555c5eb commit ae874df
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,9 @@ with teslapy.Tesla('[email protected]') as tesla:
vehicles[0].command('ACTUATE_TRUNK', which_trunk='front')
vehicles[0].get_vehicle_data()
print(vehicles[0]['vehicle_state']['car_version'])
vehicles[0].command('FLASH_LIGHTS') # Causes exception
```

The last line after the context manager will cause an exception when using TeslaPy 2.5.0+ because it closes the [requests](https://pypi.org/project/requests/) connection handler when the context manager exits. TeslaPy 2.4.0 and 2.5.0 automatically calls `get_vehicle_data()` and TeslaPy 2.6.0+ automatically calls `get_latest_vehicle_data()` when a key is not found. This example works for TeslaPy 2.6.0+:
TeslaPy 2.4.0 and 2.5.0 automatically calls `get_vehicle_data()` and TeslaPy 2.6.0+ automatically calls `get_latest_vehicle_data()` when a key is not found. This example works for TeslaPy 2.6.0+:

```python
import teslapy
Expand Down Expand Up @@ -315,7 +314,7 @@ with Tesla('[email protected]') as tesla:

### Robustness

TeslaPy uses a default timeout of 10 seconds, that can be adjusted if, for instance, the remote server is very slow. Refer to the [timeouts](https://requests.readthedocs.io/en/master/user/advanced/#timeouts) section for more details. TeslaPy does not retry failed or timed out connections by default, which can be enabled with the `retry` parameter.
TeslaPy uses an adjustable connect and read timeout of 10 seconds by default. Refer to the [timeouts](https://requests.readthedocs.io/en/master/user/advanced/#timeouts) section for more details. TeslaPy does not retry failed or timed out connections by default, which can be enabled with the `retry` parameter.

```python
tesla = teslapy.Tesla('[email protected]', retry=2, timeout=15)
Expand All @@ -330,8 +329,12 @@ import teslapy
retry = teslapy.Retry(total=2, status_forcelist=(500, 502, 503, 504))
with teslapy.Tesla('[email protected]', retry=retry) as tesla:
vehicles = tesla.vehicle_list()
print(vehicles[0])
vehicles[0].command('FLASH_LIGHTS') # Raises exception
```

The line after the context manager will raise an exception when using TeslaPy 2.5.0+ because it explicitly closes the [requests](https://pypi.org/project/requests/) connection handler when the context manager exits. Earlier versions would not raise an exception and retries would not work.

Take a look at [cli.py](https://github.com/tdorssers/TeslaPy/blob/master/cli.py), [menu.py](https://github.com/tdorssers/TeslaPy/blob/master/menu.py) or [gui.py](https://github.com/tdorssers/TeslaPy/blob/master/gui.py) for more code examples.

## Commands
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ universal = 1

[metadata]
name = TeslaPy
version = 2.5.0
version = 2.6.0
author = Tim Dorssers
author_email = [email protected]
description = A Python module to use the Tesla Motors Owner API
Expand Down
4 changes: 2 additions & 2 deletions teslapy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Author: Tim Dorssers

__version__ = '2.5.0'
__version__ = '2.6.0'

import os
import ast
Expand Down Expand Up @@ -34,7 +34,7 @@
SSO_BASE_URL = 'https://auth.tesla.com/'
SSO_CLIENT_ID = 'ownerapi'
STREAMING_BASE_URL = 'wss://streaming.vn.teslamotors.com/'
APP_USER_AGENT = 'TeslaApp/4.7.0'
APP_USER_AGENT = 'TeslaApp/4.9.0'

# Setup module logging
logger = logging.getLogger(__name__)
Expand Down

0 comments on commit ae874df

Please sign in to comment.