Hope this is the right StackExchange community to ask this question.
I am building a (Python) project that will have a list if URLs to hit. They have to be hit serially, and part of response of one API will be input to the next one. I say "part of" because which part of the response is to be fed to the next input will be different for each API.
What I have thought till now is this -
requests(not very keen for
aioas requests will be serial)
- using some kind of serialize-deserialze module
- have a
configthat holds list of entries like
- response body transformation for the next API
- request body transformation (that includes previous request's transformed response plus some additional data if required)
- store the transformed response in a top-level variable to be returned in the end
- main module to simply call this
configin order and make the data flow till the end
- for each request, it will check its request transformer and form the body accordingly (data for this can be taken from the variable mentioned above and/or from the transformer itself)
- it will then hit the API and transform the response as per response transformer and store in the above variable
- repeat for the next API
- stop the flow if any API returns non-2xx response (business requirement)
- stack: only requires Python, no db required, as it will be a script to be called by another one
Can any one suggest a better approach, or a library that can be helpful here?
Speed is not really the top-most priority, but intuitive design is.