question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error requesting networks

See original GitHub issue

I have been running 0.15 for over a week now and no issues, but yesterday it started to error on self.get_networks()

Traceback (most recent call last):
  File "scripts/grab-photo.py", line 9, in <module>
    blink.start()
  File "/var/services/homes/admin/.local/lib/python3.7/site-packages/blinkpy/blinkpy.py", line 135, in start
    self.get_auth_token()
  File "/var/services/homes/admin/.local/lib/python3.7/site-packages/blinkpy/blinkpy.py", line 176, in get_auth_token
    self.setup_params(self.login_response)
  File "/var/services/homes/admin/.local/lib/python3.7/site-packages/blinkpy/blinkpy.py", line 189, in setup_params
    self.networks = self.get_networks()
  File "/var/services/homes/admin/.local/lib/python3.7/site-packages/blinkpy/blinkpy.py", line 195, in get_networks
    response = api.request_networks(self)
  File "/var/services/homes/admin/.local/lib/python3.7/site-packages/blinkpy/api.py", line 82, in request_networks
    return http_get(blink, url)
  File "/var/services/homes/admin/.local/lib/python3.7/site-packages/blinkpy/api.py", line 301, in http_get
    is_retry=is_retry,
  File "/var/services/homes/admin/.local/lib/python3.7/site-packages/blinkpy/helpers/util.py", line 104, in http_req
    if json_resp and "code" in response.json():
  File "/var/services/homes/admin/.local/lib/python3.7/site-packages/requests/models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/python3/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/python3/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/python3/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I thought it might be the version, so I updated to the latest dev build. I had to enter in a new code but now i’m still getting a similar error:

Expected json response from https://rest-u003.immedia-semi.com/api/v3/accounts/XXXXX/homescreen, but received: 403: Forbidden
Enter code sent to XXXX@gmail.com: XXXXXX
Traceback (most recent call last):
  File "scripts/grab-photo2.py", line 13, in <module>
    blink.start()
  File "/var/services/homes/admin/.local/lib/python3.7/site-packages/blinkpy/blinkpy.py", line 114, in start
    self.setup_prompt_2fa()
  File "/var/services/homes/admin/.local/lib/python3.7/site-packages/blinkpy/blinkpy.py", line 121, in setup_prompt_2fa
    result = self.auth.send_auth_key(self, pin)
  File "/var/services/homes/admin/.local/lib/python3.7/site-packages/blinkpy/auth.py", line 207, in send_auth_key
    json_resp = response.json()
  File "/var/services/homes/admin/.local/lib/python3.7/site-packages/requests/models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/python3/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/python3/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/python3/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
tsolidcommented, Jul 11, 2020

I was following @anonymous-one in the node-js api thread and he has found a fix!

Remove / comment out all instances of “Host: …” for each of the request.post blocks.

I was able to do this in the dev build (v0.16.0-rc11) by editing auth.py:

Change Line 56 from: return {"Host": self.host, "TOKEN_AUTH": self.token} to: return {"TOKEN_AUTH": self.token}

and it worked!!

I can submit a PR later tonight but need to get back to stuff I promised my wife would get done 😃

1reaction
fronzbotcommented, Jul 11, 2020

@anonymous-one that change happened almost a year ago. This library has been using that updated endpoint since then. The only endpoint currently working is login (at least based on my testing).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Network Error Logging - HTTP - MDN Web Docs
Network Error Logging is a mechanism that can be configured via the NEL HTTP response header. This experimental header allows web sites and ......
Read more >
Network Error Logging - W3C
A network error is the error condition that caused a network request to fail. Each network error has a type , which is...
Read more >
Getting network error on http request [duplicate] - Stack Overflow
When I am trying to make a http request to a server, I am getting the following network error in Internet Explorer and...
Read more >
Network Error the API did not return a response.
When sending requests to an API endpoint, the request is sent directly from your local browser (or desktop application, if you're using Studio ......
Read more >
Login error: "Unable to process request - Server or Network ...
On a network disconnect, the client will not be able to reach the server, and hence that pop-up which indicates your connection is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found