-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
I'm wondering how hard it would be to customize to optionally use requests-oauthlib instead of just plain requests. I believe this would need to happen in ApiRequestFactory:
jsonapi-requests/jsonapi_requests/request_factory.py
Lines 54 to 63 in 49303e1
| def _request(self, absolute_url, method, **kwargs): | |
| options = self.default_options | |
| options.update(self.configured_options) | |
| options.update(kwargs) | |
| try: | |
| response = requests.request(method, absolute_url, **options) | |
| except (requests.ConnectionError, requests.Timeout): | |
| raise ApiConnectionError | |
| else: | |
| return self._parse_response(response) |
This is a few levels down into the guts but looks like for testing I could extend ApiRequestFactory and then change Api here:
jsonapi-requests/jsonapi_requests/base.py
Lines 18 to 19 in 49303e1
| def __init__(self, config: configuration.Configuration): | |
| self.requests = request_factory.ApiRequestFactory(config) |
As a "feature" I would guess just adding a parameter to config() to override the default requests.request would do the trick?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels