Update README.md with development info
This commit is contained in:
parent
4643af8d25
commit
9cf12dbc15
23
README.md
23
README.md
@ -1 +1,24 @@
|
|||||||
# API Wrapper Boilerplate
|
# API Wrapper Boilerplate
|
||||||
|
|
||||||
|
## Example Code
|
||||||
|
The example code in `main.py` uses the [JSONPlaceholder](https://jsonplaceholder.typicode.com/) demo API, which
|
||||||
|
is a great resource for learning how to work with JSON based REST APIs.
|
||||||
|
|
||||||
|
The example code also demonstrates how the wrapper will raise exceptions by initializing the `ApiWrapper` with
|
||||||
|
a broken proxy.
|
||||||
|
|
||||||
|
## Development
|
||||||
|
The ApiWrapper class includes private class convenience methods that utilize the internal `requests.Session`
|
||||||
|
object to persist session data across all API requests. When developing public methods, use the appropriate
|
||||||
|
convenience methods:
|
||||||
|
- `self.__get`
|
||||||
|
- `self.__post`
|
||||||
|
- `self.__put`
|
||||||
|
- `self.__delete`
|
||||||
|
|
||||||
|
## Error Handling
|
||||||
|
The ApiWrapper class defines custom exceptions for handling API request and response errors.
|
||||||
|
- ApiRequestException is raised when there is an issue with the API request.
|
||||||
|
- InvalidApiResponse is raised when the API response is not a valid JSON.
|
||||||
|
|
||||||
|
You can catch these exceptions and handle them accordingly in your code.
|
||||||
|
Loading…
Reference in New Issue
Block a user