Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass HTTP client instances through when creating children #12

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

acdha
Copy link
Contributor

@acdha acdha commented May 21, 2012

I have a project which uses an API which returns relative URLs and requires HTTP authentication and at times access via a proxy. This has exposed several cases where the HTTP client wasn't being passed to a child object, which would cause the initial get() to work and then subsequent accesses to fail.

acdha/remoteobjects@746ce0b passes the client to Link
acdha/remoteobjects@aa1eaf1 passes the client in to a RemoteObject during post()

The major remaining area is handling collections: currently it's complicated by the fact that a List or Dict doesn't pass a reference to itself in when creating a subfield so the fix will need to pass a reference to self or self._http from ListObject.seqmethod through into the underlying field decode. I'm currently handling this with a quick hack to fix it up on the way out of getitem but it seems like this will require changing field decode() to accept an optional http parameter to pass the value down.

@acdha
Copy link
Contributor Author

acdha commented Apr 6, 2011

An experimental test implementation is in acdha/remoteobjects@1c8c820 - see https://github.com/acdha/remoteobjects/tree/issue-12-linked-clients. It still needs tests to confirm that the same HTTP client is being passed around everywhere but it appears to work in casual testing.

acdha added 4 commits May 21, 2012 14:07
This avoids passing in None, which will get a default client which might not
contain credentials, proxy configuration, etc.
This passes through the http client to preserve credentials, proxy info, etc.
@acdha
Copy link
Contributor Author

acdha commented May 21, 2012

We have been running the attached code w/o issue for around a bit over a year without incident

@samv
Copy link

samv commented Aug 17, 2012

Hi Chris, would you be able to write at least a couple of tests to demonstrate this? I'm just starting to look at some of the old pull requests and seeing some tests would help clarify the intent of this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants