Open glotchimo opened 7 years ago
Thanks for bringing this to my attention - I'll spend this weekend combing through it
It has something to do with version because I ran it through 3.6 and it worked, but not in 2.7.
The library was rewritten recently so that it would only be Python 3+ compatible, so that's probably what happened for you.
However, sometimes when I run the function on my own machine (w/ Python 3.6) it fails, but I think it might be a different problem. I might have to do with market opening times (i.e. there are no options to choose from when the market's closed), but I can only test that when the market's open. Leaving this issue open for now until I fix that.
Update details (from StackOverflow)
This is a question involving Python, Beautiful Soup, and HTML, as well as the Investopedia API.
The first part involved is this block of Python that takes an input and executes a function based off of the given input (action is
raw_input
):The second parameter
(ita.Action.[order_type])
, written as directed in the API documentation, and as indicated in the code itself, refers to this block:That block uses
.find
from Beautiful Soup to target a drop-down menu that is formatted as such:In the API's documentation, the examples are listed to operate as follows:
However, AttributeError is reporting that
'int' object has no attribute 'value'
, in that given line, even when I've attempted to run the line as it is written in the documentation on its own.I am assuming that the
'int'
object in question is the option value from the drop-down menu, and with that, I am assuming that that an int, perhaps 1 - 4, is occupying theorderType
parameter. So, why would it be suggested that the parameter beita.Action.[buy/sell/short/etc]
, rather than just an integer value? And why does it return the same error if an integer value fulfills that parameter? Help me understand.