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:
|
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:
|
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?
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 inApiRequestFactory:jsonapi-requests/jsonapi_requests/request_factory.py
Lines 54 to 63 in 49303e1
This is a few levels down into the guts but looks like for testing I could extend ApiRequestFactory and then change
Apihere:jsonapi-requests/jsonapi_requests/base.py
Lines 18 to 19 in 49303e1
As a "feature" I would guess just adding a parameter to
config()to override the default requests.request would do the trick?