jugaad-py / jugaad-trader

Unofficial python client for Zerodha
https://marketsetup.in/documentation/jugaad-trader/
157 stars 112 forks source link

BeautifulSoup Parsing error in using kite.instruments method #38

Closed JoeTheStocker closed 2 years ago

JoeTheStocker commented 2 years ago

Describe the bug Getting a BeautifulSoup Parsing error on trying to use kite.instruments method in jugaad-trader. Can someone please suggest a workaround for this?

Code snippet kite = Zerodha() instrument = kite.instruments(exchange="NFO")

Error C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\jugaad_trader\zerodha.py:184: **GuessedAtParserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

The code that caused this warning is on line 184 of the file C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\jugaad_trader\zerodha.py. To get rid of this warning, pass the additional argument 'features="lxml"' to the BeautifulSoup constructor.

bs = BeautifulSoup(html) Expecting value: line 1 column 1 (char 0) Traceback (most recent call last): File "xx", line 86, in instrument = kite.instruments(exchange="NFO") File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\jugaad_trader\zerodha.py", line 206, in instruments chunkjs = self.chunk_to_json(js) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\jugaad_trader\zerodha.py", line 198, in chunk_to_json**

Additional context Add any other context about the problem here.

JoeTheStocker commented 2 years ago

Issue resolved by upgrading Python from 3.9 to 3.10. Closing the issue.