Skip to content

python-amcrest triggers a DNS lookup for every command #237

Description

@dunedain289

I'm using the HomeAssistant Amcrest integration, and my OPNsense router was showing 10000's of queries for my camera DNS names. My cameras have static DHCP assignments, which puts the hostname in Unbound with a 3600s TTL. I expected to see maybe 100 queries per day, but HA was generating ~300 queries per second to the camera names. Changing my HA config to IP addresses solved the problem, and I'm not seeing constant queries.

I think requests is triggering a new DNS lookup every time through this function/loop (i.e. for every single command):

https://github.com/tchellomello/python-amcrest/blob/master/src/amcrest/http.py#L290-L304

Caching the session between calls might help, but I'm not enough of a requests expert to be certain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions