Skip to content

Trouble getting new oauth to work properly. #186

Description

@4Dolio

I am following from #182

I am still having trouble, after switching from the main page example(https://github.com/tchellomello/python-ring-doorbell), and the older documentation example(https://python-ring-doorbell.readthedocs.io/), and now looking at the test.py example mentioned in the above issue. When I use the test.py I get this error.

Username: me@internet.net
Traceback (most recent call last):
File "./ring.basic.py", line 147, in
main()
File "./ring.basic.py", line 132, in main
username = input("Username: ")
File "", line 1
me@internet.net
^
SyntaxError: invalid syntax

OR this:

Username: asdf
Traceback (most recent call last):
File "./ring.basic.py", line 147, in
main()
File "./ring.basic.py", line 132, in main
username = input("Username: ")
File "", line 1, in
NameError: name 'asdf' is not defined

Previously I had my own wrapper .py script that would just scrape(download) all my clips if I did not already have the file, for archival sake, nothing more. That script takes my own set of arguments, including my username(email) and password, and I do not have 2fa enabled for my account, yet. Commenting out those two input lines asking for username and password, that it seems I can not input, does not help, results in

Traceback (most recent call last):
File "./ring.basic.py", line 147, in
main()
File "./ring.basic.py", line 136, in main
auth = Auth(None, token_updated)
File "/usr/local/lib/python2.7/dist-packages/ring_doorbell/auth.py", line 21, in init
client=LegacyApplicationClient(client_id=OAuth.CLIENT_ID), token=token
File "/home/foo/.local/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.py", line > 79, in init
self.token = token or {}
File "/home/foo/.local/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.py", line > 129, in token
self._client.populate_token_attributes(value)
File "/home/foo/.local/lib/python2.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 492, in populate_token_attributes
if 'access_token' in response:
TypeError: argument of type 'function' is not iterable

I also attempted to restore the past .ring_doorbell-session.cache file to see how that behaved and got this:

Traceback (most recent call last):
File "./ring.basic.py", line 148, in
main()
File "./ring.basic.py", line 129, in main
json.loads(cache_file.read_text()),
AttributeError: 'PosixPath' object has no attribute 'read_text'

Also fixed this typo:

print(f"Hello {ring.session['profile']['first_name']}")
^ (closing quote, ditch the extra "f")
SyntaxError: invalid syntax

Found if I double-quote my username and password responses, then it proceeds until:

Traceback (most recent call last):
File "./test.py", line 46, in
main()
File "./test.py", line 31, in main
auth = Auth(None, token_updated)
File "/usr/local/lib/python2.7/dist-packages/ring_doorbell/auth.py", line 21, in init
client=LegacyApplicationClient(client_id=OAuth.CLIENT_ID), token=token
File "/home/foo/.local/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.py", line 79, in init
self.token = token or {}
File "/home/foo/.local/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.py", line 129, in token
self._client.populate_token_attributes(value)
File "/home/foo/.local/lib/python2.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 492, in populate_token_attributes
if 'access_token' in response:
TypeError: argument of type 'function' is not iterable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions