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

Move bucket_bound_hostname code into helper #121

Closed
IlyaFaer opened this issue Apr 29, 2020 · 1 comment · Fixed by #137
Closed

Move bucket_bound_hostname code into helper #121

IlyaFaer opened this issue Apr 29, 2020 · 1 comment · Fixed by #137
Assignees
Labels
api: storage Issues related to the googleapis/python-storage API. type: cleanup An internal cleanup or hygiene concern.

Comments

@IlyaFaer
Copy link

For now we have three places in which we're using bucket_bound_hostname. The code is almost the same in all three places, so it'll be good to union it in single helper:

if ":" in bucket_bound_hostname:
api_access_endpoint = bucket_bound_hostname
else:
api_access_endpoint = "{scheme}://{bucket_bound_hostname}".format(
scheme=scheme, bucket_bound_hostname=bucket_bound_hostname
)

if ":" in bucket_bound_hostname:
api_access_endpoint = bucket_bound_hostname
else:
api_access_endpoint = "{scheme}://{bucket_bound_hostname}".format(
scheme=scheme, bucket_bound_hostname=bucket_bound_hostname
)

if ":" in bucket_bound_hostname: # URL includes scheme
url = bucket_bound_hostname
else: # scheme is given separately
url = "{scheme}://{host}/".format(
scheme=scheme, host=bucket_bound_hostname
)

@IlyaFaer IlyaFaer added api: storage Issues related to the googleapis/python-storage API. type: cleanup An internal cleanup or hygiene concern. labels Apr 29, 2020
@IlyaFaer IlyaFaer self-assigned this Apr 29, 2020
@frankyn
Copy link
Member

frankyn commented Apr 29, 2020

that sounds good, thanks for catching the improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/python-storage API. type: cleanup An internal cleanup or hygiene concern.
Projects
None yet
2 participants