- Change Summary:
-
Remove some unused imports.
- Commit:
-
291cd7bd335a10d5e9b8d2391373998b2232e76c171104540ed2149f7d4d0ff57d81c69b96affb14
Refactor HTTP access out of HostingService class.
Review Request #5691 — Created April 9, 2014 and submitted
This change adds a new
HostingServiceClient
class which handles the basic
details of HTTP and JSON communication with hosting service APIs. This is
primarily just extracting the functionality out of theHostingService
class.
IndividualHostingService
s can override this class to add additional checking
(such as GitHub's checking of rate limit headers), or add higher-level API
functionality.
- Ran unit tests.
- Tested post-commit review request creation.
Description | From | Last Updated |
---|---|---|
I think there may be some ways we can improve the relationship between the client and service here. Right now, … |
chipx86 | |
Missing trailing period. It'd also be nice to flesh this out more and say what its responsibilities are, and that … |
chipx86 | |
While we're here, can we add some docstrings to these methods? |
chipx86 | |
With the above, this would just be: self.client = self.build_client(service=self) |
chipx86 |
- Change Summary:
-
- Fix up a typo in
http_request
- Remove a line that snuck in from a highly-experimental branch.
- Fix up a typo in
- Testing Done:
-
~ Ran unit tests.
~ - Ran unit tests.
+ - Tested post-commit review request creation.
- Commit:
-
171104540ed2149f7d4d0ff57d81c69b96affb14413ee5bfd2d79ed6ab4f9e3e94af8b5d131d95ce
-
-
I think there may be some ways we can improve the relationship between the client and service here. Right now,
HostingService
is either given a client, or will construct one by itself, and having anaccount
requires doing a subclass and constructing it and passing it to theHostingService
's constructor.I'd propose we change this design a bit to ensure client construction happens in a more consistent way. I'd suggest doing this by having a
build_client
method onHostingService
that constructs aHostingServiceClient
by default, passing in*args, **kwargs
to it.HostingService.__init__
would setself.client
to this, passingservice=self
as a parameter (allowing any client to access the parent service and therefore account).GitHubClient
would then just overridebuild_client
to return an instance ofGitHubClient
instead. It wouldn't have to do anything special with the account, and would just pass the arguments it's supposed to pass.This makes it easier for us to add additional default parameters down the road and to keep
HostingService
subclasses clean. -
Missing trailing period.
It'd also be nice to flesh this out more and say what its responsibilities are, and that it can be subclassed for the same reasons you outline in the review request's description.
-
-