Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

event_actions() causes AttributeError #215

Open
maxirus opened this issue Apr 30, 2022 · 0 comments
Open

event_actions() causes AttributeError #215

maxirus opened this issue Apr 30, 2022 · 0 comments

Comments

@maxirus
Copy link

maxirus commented Apr 30, 2022

I am connecting to an Amcrest AD410 Doorbell and utilizing the event_actions() method and after about 100s, I receive the Error:
AttributeError: 'NoneType' object has no attribute 'read'.

More specifically, I am calling:
camera.event_actions("All", retries=5, timeout_cmd=(10.00, 3600)) and with DEBUG log level, I get the follow:

2022-04-30 00:42:29,922 - urllib3.connectionpool [DEBUG] Starting new HTTP connection (1): 192.168.10.20:80
2022-04-30 00:42:29,970 - urllib3.connectionpool [DEBUG] http://192.168.10.20:80 "GET /cgi-bin/eventManager.cgi?action=attach&codes=%5BAll%5D HTTP/1.1" 401 0
2022-04-30 00:44:12,784 - urllib3.connectionpool [DEBUG] http://192.168.10.20:80 "GET /cgi-bin/eventManager.cgi?action=attach&codes=%5BAll%5D HTTP/1.1" 200 None
2022-04-30 00:44:12,785 - amcrest.http [DEBUG] <Doorbell-D66A> Query 9 worked. Exit code: <200>
2022-04-30 00:44:12,786 - amcrest.event [DEBUG] <Doorbell-D66A> event info: '\r\nCode=VideoMotionInfo;action=State;index=0'
  File "/usr/local/lib/python3.10/site-packages/amcrest/event.py", line 361, in event_actions
    for event_info in self.event_stream(
  File "/usr/local/lib/python3.10/site-packages/amcrest/event.py", line 312, in event_stream
    for line in _event_lines(ret.iter_content(decode_unicode=True)):
  File "/usr/local/lib/python3.10/site-packages/amcrest/event.py", line 39, in _event_lines
    for char in ret:
  File "/usr/local/lib/python3.10/site-packages/requests/utils.py", line 549, in stream_decode_response_unicode
    for chunk in iterator:
  File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 760, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "/usr/local/lib/python3.10/site-packages/urllib3/response.py", line 575, in stream
    for line in self.read_chunked(amt, decode_content=decode_content):
  File "/usr/local/lib/python3.10/site-packages/urllib3/response.py", line 770, in read_chunked
    chunk = self._handle_chunk(amt)
  File "/usr/local/lib/python3.10/site-packages/urllib3/response.py", line 714, in _handle_chunk
    value = self._fp._safe_read(amt)
  File "/usr/local/lib/python3.10/http/client.py", line 630, in _safe_read
    data = self.fp.read(amt)
AttributeError: 'NoneType' object has no attribute 'read'

What's also odd that I first get a 401 response before eventually getting a 200. Not sure if this is affecting things tho as I see the same behavior with other calls (ie camera.storage_all) and they return fine.

Environment:

  • OS: Debian GNU/Linux 10 (buster)
  • Python: 3.10
    • amcrest: 1.9.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant