Comments (1)
For the explanation, I use a 404 error I produced but the same applies to the rest of the errors.
If you log the error.response.body
you will get the raw response of the error, as a string.
{"errors":[{"status":404,"code":404,"title":"NOT FOUND","detail":"No results matching the query","source":{"parameter":"id","example":"Q930111419"}}],"data":{"self":{}}}
If you log the error.response.result
you will get the. body parsed as JSON
{'errors': [{'status': 404, 'code': 404, 'title': 'NOT FOUND', 'detail': 'No results matching the query', 'source': {'parameter': 'id', 'example': 'Q930111419'}}], 'data': {'self': {}}}
Then you can parse the error and take specific fields, for example, you can access the detail with as
error.response.result['errors'][0]['detail']
No results matching the query
The same logic applies to get the title and other fields as well.
from amadeus-python.
Related Issues (20)
- 500 Server error when trying to get the cheapest flights HOT 1
- SonarCloud failed from fork repository
- Outdated pygments and sphinx versions
- Replace type() with instance()
- Update the default value {} as an argument
- Update methods that do not use their bound instance
- Reference Docs is not up to date HOT 1
- kids while looking for tickets HOT 4
- The errors aren't well formatted. And do not return json but html. Secondly, adding nonStop parameter to the Flight Offer Search endpoint also throws errors. HOT 2
- New Transfer APIs to be added
- Enquiry if we can get redemtion miles/points offer on Flight Serach api HOT 1
- Filter flight offer search by date and time HOT 3
- Misleading Documentation Example HOT 1
- Possible Name Collision Confusion in Primary Documentation Example.
- Issue with search hotels by id
- Query Parameter of Type List Does Not Work As Expected
- Is there a field definition guide? Appreciated HOT 2
- Add custom headers? HOT 1
- Error code 2668 not returned with SDK, but works with curl request HOT 2
- Query parameter 'scheduledDepartureDate' should not be past date 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 amadeus-python.