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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add method to close httplib2 connections #1038

merged 3 commits into from Sep 23, 2020


Copy link

@busunkim96 busunkim96 commented Sep 22, 2020

Fixes #618 馃

httplib2 leaves sockets open by default. This can lead to situations where programs run out of available sockets. httplib2 added a method last year to clean up connections.

This PR adds two ways to close http connections. The interface is intentionally similar to the proposed design for GAPIC clients. googleapis/gapic-generator-python#575

explicitly call close:

from googleapiclient import discovery

service ="drive", "v3")

context manager:

from googleapiclient import discovery

with"drive", "v3") as service:

# service.__exit__() is called which calls service.close()
Copy link

@gcf-merge-on-green gcf-merge-on-green bot commented Sep 23, 2020

Your PR has attempted to merge for 3 hours. Please check that all required checks have passed, you have an automerge label, and that all your reviewers have approved the PR

Copy link

@gcf-merge-on-green gcf-merge-on-green bot commented Sep 23, 2020

Merge-on-green attempted to merge your PR for 6 hours, but it was not mergeable because either one of your required status checks failed, or one of your required reviews was not approved. Learn more about your required status checks here: You can remove and reapply the label to re-run the bot.

@tswast tswast requested a review from as a code owner Sep 23, 2020
tswast approved these changes Sep 23, 2020
@busunkim96 busunkim96 merged commit 98888da into googleapis:master Sep 23, 2020
3 of 4 checks passed
@busunkim96 busunkim96 deleted the context-manager-for-httplib2 branch Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants