Giter Site home page Giter Site logo

Comments (10)

ryanwinter avatar ryanwinter commented on May 18, 2024 1

Awesome, so this is pretty much as expected. The Arlo Q cameras act as their own base station.

from python-arlo.

tchellomello avatar tchellomello commented on May 18, 2024

Related issue: home-assistant/core#8412

from python-arlo.

broox avatar broox commented on May 18, 2024

Can anyone with an Arlo Q camera show what the API response looks like so that we can add it to a test fixture?

from python-arlo.

ryanwinter avatar ryanwinter commented on May 18, 2024

I duplicated some work with the basestation to see if I could get something working, however I'm having some initial problems with the sseclient.

        url = SUBSCRIBE_ENDPOINT + "?token=" + self._session_token
        data = self._session.query(url, method='GET', raw=True, stream=True)
        self.__sseclient = sseclient.SSEClient(data)

data ends up being <Response> which obviously doesnt plug into the SSEClient call very well and throws an exception. Does this call return some subscription URL for the basestation?

I dont know too much about the SSEClient subscription service, but I do see this call working successfully with the device through arlo.netgear.com.

from python-arlo.

ryanwinter avatar ryanwinter commented on May 18, 2024

I'm blocked by this at the moment, does anyone have any insight?

from python-arlo.

tchellomello avatar tchellomello commented on May 18, 2024

Hello @ryanwinter, what kind of error are you getting? I just ran a quick test with rpdb here and it worked to me.

telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
> /home/mdemello/devel/python-arlo/pyarlo/base_station.py(49)thread_function()
-> self.__subscribed = True
(Pdb) l
 44
 45         def thread_function(self):
 46             """Thread function."""
 47
 48             import rpdb; rpdb.set_trace()
 49  ->         self.__subscribed = True
 50             url = SUBSCRIBE_ENDPOINT + "?token=" + self._session_token
 51
 52             data = self._session.query(url, method='GET', raw=True, stream=True)
 53             self.__sseclient = sseclient.SSEClient(data)
 54
(Pdb) n
> /home/mdemello/devel/python-arlo/pyarlo/base_station.py(50)thread_function()
-> url = SUBSCRIBE_ENDPOINT + "?token=" + self._session_token
(Pdb) n
> /home/mdemello/devel/python-arlo/pyarlo/base_station.py(52)thread_function()
-> data = self._session.query(url, method='GET', raw=True, stream=True)
(Pdb) url
'https://arlo.netgear.com/hmsweb/client/subscribe?token=2_5tW9XE5l3RVbbyQ<REDACTED>

> /home/mdemello/devel/python-arlo/pyarlo/base_station.py(53)thread_function()
-> self.__sseclient = sseclient.SSEClient(data)
(Pdb) data
<Response [200]>
(Pdb) n
> /home/mdemello/devel/python-arlo/pyarlo/base_station.py(55)thread_function()
-> for event in (self.__sseclient).events():

(Pdb) dir(self._ArloBaseStation__sseclient)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_char_enc', '_event_source', '_logger', '_read', 'close', 'events']
(Pdb)

(Pdb) self._ArloBaseStation__sseclient.events()
<generator object SSEClient.events at 0x7f5254bd0830>

Where events() will only return some data from that thread in case of a notification event.

Does it make sense? What error are you getting?

from python-arlo.

ryanwinter avatar ryanwinter commented on May 18, 2024

This makes sense, the part I'm having issues with is line 52/53. What is the purpose of line 52? I'm getting the data = "<Response [200]>", but then SSEClient throws an error with that input.

I'm still trying to get my head around the debugging here, maybe I have a bad dependency?

Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "C:\Program Files\Python36\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "D:\projects\python-arlo\pyarlo\base_station_q.py", line 54, in thread_function
    self.__sseclient = sseclient.SSEClient(data)
  File "C:\Program Files\Python36\lib\site-packages\sseclient.py", line 39, in __init__
    self._connect()
  File "C:\Program Files\Python36\lib\site-packages\sseclient.py", line 47, in _connect
    self.resp = requester.get(self.url, stream=True, **self.requests_kwargs)
  File "C:\Program Files\Python36\lib\site-packages\requests\api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Program Files\Python36\lib\site-packages\requests\api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Program Files\Python36\lib\site-packages\requests\sessions.py", line 494, in request
    prep = self.prepare_request(req)
  File "C:\Program Files\Python36\lib\site-packages\requests\sessions.py", line 437, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "C:\Program Files\Python36\lib\site-packages\requests\models.py", line 305, in prepare
    self.prepare_url(url, params)
  File "C:\Program Files\Python36\lib\site-packages\requests\models.py", line 379, in prepare_url
    raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL '<Response [200]>': No schema supplied. Perhaps you meant http://<Response [200]>?

from python-arlo.

ryanwinter avatar ryanwinter commented on May 18, 2024

Ok, so making some progress, it seems I had install sseclient, instead of sseclient-py :|

from python-arlo.

tchellomello avatar tchellomello commented on May 18, 2024

@ryanwinter oh.. good to know that!! So we will need to modify the code in order to check the try to modify its behavior. Are you working on a patch to make it fully compatible with Arlo Q camera since you own them?

from python-arlo.

Megachip avatar Megachip commented on May 18, 2024

Reference:
home-assistant/core#15026 (comment)

from python-arlo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.