Open n2ygk opened 5 years ago
I totally agree with you.
I think the easiest way to allow any requests customizations would be to allow to pass requests.Session object as configuration. This would also allow stuff like client side ssl certificates.
We can just replace requests.request with self.session.request.
That would make AUTH configuration a bit redundant, but I think it should be ok as easier option than setting Session object for such simple case.
śr., 20 lut 2019, 20:49 użytkownik Alan Crosswell notifications@github.com napisał:
I'm wondering how hard it would be to customize to optionally use requests-oauthlib https://requests-oauthlib.readthedocs.io/ instead of just plain requests. I believe this would need to happen in ApiRequestFactory: https://github.com/socialwifi/jsonapi-requests/blob/49303e1e55a5cbd052c184829d37124a37728468/jsonapi_requests/request_factory.py#L54-L63
This is a few levels down into the guts but looks like for testing I could extend ApiRequestFactory and then change Api here: https://github.com/socialwifi/jsonapi-requests/blob/49303e1e55a5cbd052c184829d37124a37728468/jsonapi_requests/base.py#L18-L19
As a "feature" I would guess just adding a parameter to config() to override the default requests.request would do the trick?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/socialwifi/jsonapi-requests/issues/45, or mute the thread https://github.com/notifications/unsubscribe-auth/AChkHrSlSWhArMLAwdC3gOr-iuHFmXhwks5vPabdgaJpZM4bF_Aa .
You can just use the OAuth and OAuth2 objects of requests-oauthlib in the Auth configuration parameter.
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
: https://github.com/socialwifi/jsonapi-requests/blob/49303e1e55a5cbd052c184829d37124a37728468/jsonapi_requests/request_factory.py#L54-L63This is a few levels down into the guts but looks like for testing I could extend ApiRequestFactory and then change
Api
here: https://github.com/socialwifi/jsonapi-requests/blob/49303e1e55a5cbd052c184829d37124a37728468/jsonapi_requests/base.py#L18-L19As a "feature" I would guess just adding a parameter to
config()
to override the default requests.request would do the trick?