srcfl / srcful-gateway

Sourceful Energy Gateway: Connect your solar inverter or Utility meters to earn tokens.
https://sourceful.energy/
MIT License
5 stars 2 forks source link

AttributeError: 'GetNameTask' object has no attribute 'response' #97

Closed davmoz closed 9 months ago

davmoz commented 9 months ago
[Logs]    [2024-01-26T10:03:32.980Z] [web] 10.2.0.1 - - [26/Jan/2024 10:03:32] "GET /api/crypto HTTP/1.1" 200 -
[Logs]    [2024-01-26T10:03:33.870Z] [web] 10.2.0.1 - - [26/Jan/2024 10:03:33] "GET /favicon.ico HTTP/1.1" 200 -
[Logs]    [2024-01-26T10:35:44.168Z] [web] 10.2.0.1 - - [26/Jan/2024 10:35:44] "GET / HTTP/1.1" 200 -
[Logs]    [2024-01-26T10:35:44.553Z] [web] 10.2.0.1 - - [26/Jan/2024 10:35:44] "GET /api/crypto HTTP/1.1" 200 -
[Logs]    [2024-01-26T10:35:45.167Z] [web] 10.2.0.1 - - [26/Jan/2024 10:35:45] "GET /favicon.ico HTTP/1.1" 200 -
[Logs]    [2024-01-26T10:01:39.915Z] [web] ERROR:server.tasks.srcfulAPICallTask:HTTPSConnectionPool(host='api.srcful.dev', port=443): Max retries exceeded with url: / (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f7f1b6a10>: Failed to resolve 'api.srcful.dev' ([Errno -3] Try again)"))'Traceback (most recent call last):\n  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 203, in _new_conn\n    sock = connection.create_connection(\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/urllib3/util/connection.py", line 60, in create_connection\n    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):\n               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/socket.py", line 962, in getaddrinfo\n    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):\n               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nsocket.gaierror: [Errno -3] Try again\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 790, in urlopen\n    response = self._make_request(\n               ^^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 491, in _make_request\n    raise new_e\n  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 467, in _make_request\n    self._validate_conn(conn)\n  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1096, in _validate_conn\n    conn.connect()\n  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 611, in connect\n    self.sock = sock = self._new_conn()\n                       ^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 210, in _new_conn\n    raise NameResolutionError(self.host, self, e) from e\nurllib3.exceptions.NameResolutionError: <urllib3.connection.HTTPSConnection object at 0x7f7f1b6a10>: Failed to resolve \'api.srcful.dev\' ([Errno -3] Try again)\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n  File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 486, in send\n    resp = conn.urlopen(\n           ^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 844, in urlopen\n    retries = retries.increment(\n              ^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 515, in increment\n    raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]\n    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nurllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=\'api.srcful.dev\', port=443): Max retries exceeded with url: / (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f7f1b6a10>: Failed to resolve \'api.srcful.dev\' ([Errno -3] Try again)"))\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File "/server/tasks/srcfulAPICallTask.py", line 66, in post\n    self.reply = requests.post(self.post_url, json=json)\n                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 115, in post\n    return request("post", url, data=data, json=json, **kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request\n    return session.request(method=method, url=url, **kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request\n    resp = self.send(prep, **send_kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send\n    r = adapter.send(request, **kwargs)\n        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 519, in send\n    raise ConnectionError(e, request=request)\nrequests.exceptions.ConnectionError: HTTPSConnectionPool(host=\'api.srcful.dev\', port=443): Max retries exceeded with url: / (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f7f1b6a10>: Failed to resolve \'api.srcful.dev\' ([Errno -3] Try again)"))'
[Logs]    [2024-01-26T10:01:39.917Z] [web] ----------------------------------------
[Logs]    [2024-01-26T10:01:39.917Z] [web] Exception occurred during processing of request from ('172.17.0.1', 50008)
[Logs]    [2024-01-26T10:01:39.917Z] [web] Traceback (most recent call last):
[Logs]    [2024-01-26T10:01:39.918Z] [web]   File "/usr/local/lib/python3.11/socketserver.py", line 317, in _handle_request_noblock
[Logs]    [2024-01-26T10:01:39.919Z] [web]     self.process_request(request, client_address)
[Logs]    [2024-01-26T10:01:39.919Z] [web]   File "/usr/local/lib/python3.11/socketserver.py", line 348, in process_request
[Logs]    [2024-01-26T10:01:39.919Z] [web]     self.finish_request(request, client_address)
[Logs]    [2024-01-26T10:01:39.920Z] [web]   File "/usr/local/lib/python3.11/socketserver.py", line 361, in finish_request
[Logs]    [2024-01-26T10:01:39.920Z] [web]     self.RequestHandlerClass(request, client_address, self)
[Logs]    [2024-01-26T10:01:39.920Z] [web]   File "/server/web/server.py", line 50, in __init__
[Logs]    [2024-01-26T10:01:39.921Z] [web]     super(Handler, self).__init__(*args, **kwargs)
[Logs]    [2024-01-26T10:01:39.921Z] [web]   File "/usr/local/lib/python3.11/socketserver.py", line 755, in __init__
[Logs]    [2024-01-26T10:01:39.921Z] [web]     self.handle()
[Logs]    [2024-01-26T10:01:39.921Z] [web]   File "/usr/local/lib/python3.11/http/server.py", line 436, in handle
[Logs]    [2024-01-26T10:01:39.921Z] [web]     self.handle_one_request()
[Logs]    [2024-01-26T10:01:39.922Z] [web]   File "/usr/local/lib/python3.11/http/server.py", line 424, in handle_one_request
[Logs]    [2024-01-26T10:01:39.922Z] [web]     method()
[Logs]    [2024-01-26T10:01:39.922Z] [web]   File "/server/web/server.py", line 146, in do_GET
[Logs]    [2024-01-26T10:01:39.922Z] [web]     code, response = api_handler.do_get(rdata)
[Logs]    [2024-01-26T10:01:39.922Z] [web]                      ^^^^^^^^^^^^^^^^^^^^^^^^^
[Logs]    [2024-01-26T10:01:39.923Z] [web]   File "/server/web/handler/get/name.py", line 26, in do_get
[Logs]    [2024-01-26T10:01:39.923Z] [web]     return t.response.status, json.dumps({"body": t.response.body})
[Logs]    [2024-01-26T10:01:39.924Z] [web]            ^^^^^^^^^^
[Logs]    [2024-01-26T10:01:39.924Z] [web] AttributeError: 'GetNameTask' object has no attribute 'response'
[Logs]    [2024-01-26T10:01:39.924Z] [web] ----------------------------------------
[Logs]    [2024-01-26T10:01:43.850Z] [web] DEBUG:urllib3.connectionpool:https://api.srcful.dev:443 "POST / HTTP/1.1" 200 None
[Logs]    [2024-01-26T10:01:43.859Z] [web] 172.17.0.1 - - [26/Jan/2024 10:01:43] "GET /api/name HTTP/1.1" 200 -
[Logs]    [2024-01-26T10:02:04.827Z] [web] 172.17.0.1 - - [26/Jan/2024 10:02:04] "GET /api/uptime HTTP/1.1" 200 -
[Logs]    [2024-01-26T13:42:13.707Z] [web] 172.17.0.1 - - [26/Jan/2024 13:42:13] "GET /api/uptime HTTP/1.1" 200 -
[Logs]    [2024-01-26T13:42:37.777Z] [web] 10.2.0.1 - - [26/Jan/2024 13:42:37] "GET / HTTP/1.1" 200 -
[Logs]    [2024-01-26T13:42:38.884Z] [web] 10.2.0.1 - - [26/Jan/2024 13:42:38] "GET /api/crypto HTTP/1.1" 200 -
[Logs]    [2024-01-26T13:42:39.777Z] [web] 10.2.0.1 - - [26/Jan/2024 13:42:39] "GET /favicon.ico HTTP/1.1" 200 -
[Logs]    [2024-01-26T13:42:43.709Z] [web] 172.17.0.1 - - [26/Jan/2024 13:42:43] "GET /api/uptime HTTP/1.1" 200 -
image
h0bb3 commented 9 months ago

fixed