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

Max recursion depth exceeded error #82

Closed
Psynbiotik opened this issue Jul 25, 2018 · 0 comments
Closed

Max recursion depth exceeded error #82

Psynbiotik opened this issue Jul 25, 2018 · 0 comments
Milestone

Comments

@Psynbiotik
Copy link

Bug

Work Environment

Question Answer
OS version (client) Mac 10.13.4
TheHive4py 1.4.4

Problem Description

max recursion depth exceeded error
This happens when attempting to send an alert to the hive.

Steps to Reproduce

  1. Create alert, have the description encoded like so: description.encode('UTF-8')
  2. send alert to hive, api.create_alert(alert)
  3. profit

Possible Solutions

I created a pull request with the code that fixed the issue for me:
#80
The crux of the issue is when it doesn't know how to get a serializable obejct from something it is supposed to raise an exception, instead the current code recalls the same method that was just called, in an attempt to encode the object, causing an endless recursion.

My pull request instead falls back to the base implementation causing an exception to be raised when it doesn't know how to return a serializable object, this is the technique the docs suggest you use.
From the docs:
Implement this method in a subclass such that it returns
a serializable object for o, or calls the base implementation
(to raise a TypeError).

This was somewhat difficult to track down, once I found this error and fixed it I was able to discover my problem, I was passing bytes in the description field. Without an exception being raised it was impossible to find out what was happening.

@nadouani nadouani added this to the 1.5.0 milestone Sep 24, 2018
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

2 participants