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

Getting this to work with FastAPI or another Async Backend #112

Open
waseemhnyc opened this issue May 24, 2024 · 0 comments
Open

Getting this to work with FastAPI or another Async Backend #112

waseemhnyc opened this issue May 24, 2024 · 0 comments

Comments

@waseemhnyc
Copy link

When attempting to do this in my FastAPI backend. I am noticing that the request is getting blocked.

    handler = LogDNAHandler(key='')
    logging.getLogger().addHandler(handler)
    logging.info("Checking to see if it works!")

Looking at the library. I included the print "Request Sent". It never gets printed, the request does not execute, the backend sits there and I need to restart the entire app.

        try:
            headers = {
                'user-agent': self.user_agent,
                'apikey': self.key
            }
            response = requests.post(url=self.url,
                                     json=data,
                                     params={
                                         'hostname': self.hostname,
                                         'ip': self.ip,
                                         'mac': self.mac,
                                         'tags': self.tags,
                                         'now': int(time.time() * 1000)
                                     },
                                     stream=True,
                                     allow_redirects=True,
                                     timeout=self.request_timeout,
                                     headers=headers)
            print("Request Sent") 
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