Comments (7)
Hey @FabioFleitas thanks for looking into this. I think this is solid way to handle this case. It's a unique situation because when a 504 occurs, the response returned is empty, so I'm curious to see what value resp.content
has. Is it empty as well or is it the status message of Gateway Timeout
.
If you submit a PR for it, we'll gladly merge it in!
from lob-python.
You're right, it seems like the response returned is an empty string. Perhaps we could modify it to be:
if resp.status_code == 504:
raise error.APIConnectionError(resp.content or 'Gateway Timeout',
resp.content, resp.status_code, resp)
In the chance that resp.content
is an empty string?
from lob-python.
Hmm... Try seeing if there's any content in resp.reason
. That might have the more generic message that is mapped to the status code.
from lob-python.
Unfortunately our logs didn't save the resp.reason
so not sure how I could go about testing to see what it says.
from lob-python.
Perhaps we go with error_msg = resp.content or resp.reason or 'Gateway Timeout'
if we're unsure?
from lob-python.
I just quickly tested it using http://httpstat.us/504 and this:
print resp.status_code
if resp.status_code == 504:
print resp.reason
printed this:
504
Gateway Timeout
So I think relying on resp.reason
is a safe bet 👍
from lob-python.
Alright, let's do resp.content or resp.reason
in case later down the road there is something in content? I noticed for example that http://httpstat.us/504 had "504 Gateway Timeout" as the content.
from lob-python.
Related Issues (20)
- Syntax error on line 43 "except Exception, 3:" HOT 7
- import issue on AWS Lambda HOT 5
- in `list()` endpoint, cannot specify `metadata` with more than 1 key HOT 2
- Ink-Free Area Alignment HOT 1
- lob API returning 503 throws HOT 5
- Is there a way to specify a timeout for requests? HOT 3
- Is there a way to specify the API key to use on a per-call or per-endpoint basis? HOT 2
- Add coveralls ingestion to GH actions
- Changelog HOT 1
- Add version 5 to pypi if it's ready for usage? HOT 2
- Cannot retrieve Bank Account Information or Send Checks using lob_python HOT 4
- Check validation fails for certain valid amounts, but check is sent anyway HOT 2
- SyntaxError when importing CreativeWritable HOT 3
- ApiTypeError in last version
- Importing MultipleComponents or MultipleComponentsList raises SyntaxError HOT 1
- Support querying on metadata
- Use Src directory instead of lob in all examples HOT 4
- add instructions for running examples HOT 1
- missing requirements.txt file for examples HOT 1
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 lob-python.