Closed tavasti closed 3 years ago
Hi @tavasti, thank you too for reporting the issues! :fire:
Indeed I included an option so that whenever the parameter n_results
is 1
, instead of returning a list with just one SearchObj
, just the SearchObj
is returned. Anyway, it seems that I need to include another if-statement so as to just proceed with this approach whenever n_results=1
, and not whenever there's just one result, which is not the same.
Thank you for reporting this too!
P.S.: As a quick fix you can just
result = results[0] if isinstance(results, list) else results
P.S.: As a quick fix you can just
result = results[0] if isinstance(results, list) else results
Yeah, that is what I did, but still wanted to report this because most likely there will be other people who hit the same.
Hi again @tavasti I'll be fixing this so that it just returns a single value if n_results=1
otherwise it will return a list
even if that list just contains a single value, should that fix the issue/bug? Thanks!
Yeah, that sounds correct!
Hi @tavasti this has already been solved! :fire: So the current behaviour is:
>>> import investpy
>>> data = investpy.search_quotes('LU0486851024',products=["etfs"],countries=["germany"])
>>> data
[<investpy.utils.search_obj.SearchObj object at 0x7fd8e28d53d0>]
>>> data = investpy.search_quotes('LU0486851024',products=["etfs"],countries=["germany"], n_results=1)
>>> data
<investpy.utils.search_obj.SearchObj object at 0x7fd8e28d5370>
This will be available in the next release investpy v1.0.7
later this weekend once I complete all the issues included in the current milestone! :balloon:
Hi @tavasti, the new release is already out! :fire:
You can already install it using either pip install investpy==1.0.7
or just update the current version that you are using with pip install investpy --upgrade
. Thanks a lot for your support! :+1:
For more information about this new release, you should check investpy v1.0.7 Release :balloon:
Thanks for fixing search_quotes back to live quickly!
However, there is one more thing in it:
search_quotes returns list when getting multiple entries, but single object when there is only one:
Should it return list in any case?