anthonyk1225 / robinhood-to-xlsx

Python package that grabs your robinhood data and exports it to excel
MIT License
14 stars 3 forks source link

JSON to XLSX OperationalError #3

Closed schmader closed 4 years ago

schmader commented 5 years ago

Authentication and JSON files download just fine. But, I receive this error when running for XLSX.

[?] What would you like to run: xlsx(Excel file)
   json(Robinhood history)
 > xlsx(Excel file)

[?] What would you like to generate?: orders
   dividends
   events
   options
 > orders
   cancel

SENDING REQUEST FOR THE INSTRUMENT URL
There was an error fetching the instrument 'OperationalError' object has no attribute 'message'
SENDING REQUEST FOR THE INSTRUMENT URL
There was an error fetching the instrument 'OperationalError' object has no attribute 'message'
Traceback (most recent call last):
  File "app.py", line 49, in <module>
    run()
  File "app.py", line 43, in run
    json_to_xlsx.run(report_answer)
  File "/Users/emilyschmader/robinhood-to-xlsx/controllers/json_to_xlsx.py", line 33, in run
    sorted_data = sorted(filtered_data, key=lambda k: k[entity_sort_on[entity]]) 
  File "/Users/emilyschmader/robinhood-to-xlsx/controllers/json_to_xlsx.py", line 33, in <lambda>
    sorted_data = sorted(filtered_data, key=lambda k: k[entity_sort_on[entity]]) 
KeyError: 'symbol'
anthonyk1225 commented 4 years ago

Hey, @schmader. Thanks a lot for taking time out to post the problem you encountered.

First problem is the error in Exception doesn't have the field message in Python 3. I've updated this. Moving forward, we will be able to see the actual error.

I've also updated orders to omit an item if it encounters a problem with the instruments. This should still allow the excel file to be built. Let me know if you start to get a more descriptive error message moving forward with the instruments.

anthonyk1225 commented 4 years ago

Curious if you're still encountering this problem? I've made fixes since the last time you posted and would be interested in hearing if it's been resolved. Thanks, man.