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

Documentation mismatch on function return #165

Closed
haam3r opened this issue Jun 12, 2020 · 2 comments · Fixed by #166
Closed

Documentation mismatch on function return #165

haam3r opened this issue Jun 12, 2020 · 2 comments · Fixed by #166
Assignees
Milestone

Comments

@haam3r
Copy link

haam3r commented Jun 12, 2020

Bug

Work Environment

Question Answer
OS version (server) Ubuntu
OS version (client) Mac
TheHive4py version / git hash 1.7.1

Problem Description

api.find_first() function should, according to doc strings return a requests.Response object. It however returns a regular Python dict.

Relevant lines in code: https://github.com/TheHive-Project/TheHive4py/blob/1.x/thehive4py/api.py#L433-L439

Steps to Reproduce

case = api.find_first(query=query, sort=['-title'], range='all')

# This will fail
# print(case.json())

# This works
print(case)

Possible Solutions

Two options:

  1. Change documentation to say that the returned object is a dict of the case description.
  2. Change the returned object to be of type requests.Response.

Complementary information

Currently the first matched case is returned by selecting the first element in the JSON array returned by the search API. Would it make more sense to instead set the range parameter to range='0-1'?

Happy to submit a PR for this, if a solution is decided upon.

@nadouani nadouani self-assigned this Jun 15, 2020
@nadouani
Copy link
Contributor

Hello @haam3r of course the range param must be fixed to 0-1

@nadouani nadouani added this to the 1.8.0 milestone Jun 15, 2020
@haam3r
Copy link
Author

haam3r commented Jun 15, 2020

Ack I'll submit a PR against the 1.x branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants