Skip to content

use requests-oauthlib? #45

@n2ygk

Description

@n2ygk

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions