Comments (6)
Catching exception may hide other (unknown) errors, which should be avoided in general.
Right now etrade's response can only be either valid json object or empty (BTW, in this case they should return {}
from their server, but we cannot change their server behavior), so checking empty is good enough for this client library.
from pyetrade.
Also on line 204:
req.json()
basically every time we return json, we need to check if the req.text is empty first; otherwise, we have this error.
from pyetrade.
Something like this and if req.text is ""
it would just return that?
if resp_format == "json" and req.text != ""
...
I can see how a order list could come back blank but not sure we would expect similar responses elsewhere and have that be valid?
from pyetrade.
if it's empty, just return valid empty json object {}
.
otherwise, return regular json.
from pyetrade.
at that its probably best to handle the exception and on exception return {}
try:
req.json()
except simplejson.errors.JSONDecodeError:
return {}
What do you think?
from pyetrade.
Shouldn't we have a final exception catch that does a raise so we can discover new etrade "features"?
from pyetrade.
Related Issues (20)
- Are contingent orders actually supported? HOT 1
- oauth problems HOT 1
- oauth issue HOT 6
- [Warning!] ETrade API *sever* bug: Stop Price and Trailing Stop Parameter are swapped! HOT 3
- Preview order working but place order responding with same error again and again. HOT 1
- Verification code HOT 2
- Automatic Authentication HOT 2
- 401 Client Error: Unauthorized for URL in prod HOT 1
- auth server down on 2022-06-29
- 401 Client Error: Unauthorized for url HOT 2
- HTTPError: 401 Client Error: Unauthorized for url HOT 1
- oauth no longer working HOT 8
- Keep getting requests.exceptions.HTTPError: 400 Client Error: Bad Request for url when trying to place options order. HOT 8
- Exception: 500 Server Error: Internal Server Error for url When using preview_equity_order function
- Question about Etrade API HOT 2
- get_quote for an option call returns the put HOT 1
- Q: anyone saw this error: Token request failed with code 500 HOT 2
- SSL errors with Python 3.11 HOT 14
- urllib3 version needs to be 1.xx.xx HOT 2
- Cannot grab optionchain data with ETrade API in Python HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyetrade.