lephisto / tesla-apiscraper

API Scraper for pulling Vehicle Statistics from the Tesla Owner API into an InfluxDB + Grafana Dashboards
GNU Lesser General Public License v3.0
365 stars 104 forks source link

Scraper crash when Android App calls it #78

Closed Kobitv closed 4 years ago

Kobitv commented 4 years ago

Hi, I have a problem with the Android App. As soon as the app connects to the API URL at port 8023, the scraper will crash with following log:

`Eleonore:tesla-apiscraper kobi$ python3 apiscraper.py 2019-09-27 20:09:09 INFO HTTP Server Thread started on port 8023 2019-09-27 20:09:10 INFO HTTP Error: HTTP Error 408: Request Timeout 2019-09-27 20:09:10 INFO Asleep since: 0 Sleeping for 1 seconds.. 2019-09-27 20:09:12 INFO HTTP Error: HTTP Error 408: Request Timeout 2019-09-27 20:09:12 INFO Asleep since: 0 Sleeping for 1 seconds.. 2019-09-27 20:09:14 INFO HTTP Error: HTTP Error 408: Request Timeout 2019-09-27 20:09:14 INFO Asleep since: 0 Sleeping for 1 seconds.. 2019-09-27 20:09:16 INFO HTTP Error: HTTP Error 408: Request Timeout 2019-09-27 20:09:16 INFO Asleep since: 0 Sleeping for 1 seconds.. 109.41.192.44 - - [27/Sep/2019 20:09:16] "POST /switch HTTP/1.1" 200 - 2019-09-27 20:09:16 INFO Command Queue not empty: scrape, value: True 2019-09-27 20:09:16 INFO Stop Scrape requested 109.41.192.44 - - [27/Sep/2019 20:09:16] "GET /state HTTP/1.1" 200 -

Exception happened during processing of request from ('109.41.192.44', 7039) Traceback (most recent call last): File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 316, in _handle_request_noblock self.process_request(request, client_address) File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 347, in process_request self.finish_request(request, client_address) File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 360, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 720, in init self.handle() File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/server.py", line 426, in handle self.handle_one_request() File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/server.py", line 414, in handle_one_request method() File "apiscraper.py", line 352, in do_GET "lastdatafromtesla": int(last_data_from_tesla/1000), TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

109.41.192.44 - - [27/Sep/2019 20:09:16] "GET /state HTTP/1.1" 200 -

Exception happened during processing of request from ('109.41.192.44', 16389) Traceback (most recent call last): File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 316, in _handle_request_noblock self.process_request(request, client_address) File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 347, in process_request self.finish_request(request, client_address) File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 360, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 720, in init self.handle() File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/server.py", line 426, in handle self.handle_one_request() File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/server.py", line 414, in handle_one_request method() File "apiscraper.py", line 352, in do_GET "lastdatafromtesla": int(last_data_from_tesla/1000), TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

109.41.192.44 - - [27/Sep/2019 20:09:44] "GET /state HTTP/1.1" 200 -

Exception happened during processing of request from ('109.41.192.44', 22519) Traceback (most recent call last): File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 316, in _handle_request_noblock self.process_request(request, client_address) File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 347, in process_request self.finish_request(request, client_address) File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 360, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 720, in init self.handle() File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/server.py", line 426, in handle self.handle_one_request() File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/server.py", line 414, in handle_one_request method() File "apiscraper.py", line 352, in do_GET "lastdatafromtesla": int(last_data_from_tesla/1000), TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

`

Would somebody be able to suggest to me what is wrong with my config?

Thank you

Kobitv commented 4 years ago

Solved! The car just needed to be awake.