apteryx
Advanced tools
| def retry(f, n, *fargs, **fkwargs): | ||
| for t in range(n): | ||
| try: | ||
| res = f(*fargs, **fkwargs) | ||
| return res | ||
| except ValueError: | ||
| print(f'Failed {t} time(s); trying again {n-t} more time(s).') | ||
| continue |
@@ -10,6 +10,14 @@ from typing import Union | ||
| credentials = service_account.Credentials.from_service_account_file(os.getenv('GCLOUD_CREDENTIALS', input('abs path to GCP credentials: '))) | ||
| client = storage.Client(project=os.getenv('GCLOUD_PROJECT', input('GCLOUD_PROJECT: ')), credentials=credentials) | ||
| creds_path = os.getenv('GCLOUD_CREDENTIALS') | ||
| if not creds_path: | ||
| creds_path = input('abs path to GCP credentials:') | ||
| gcloud_project = os.getenv('GCLOUD_PROJECT') | ||
| if not gcloud_project: | ||
| gcloud_project = input('GCLOUD_PROJECT: ') | ||
| credentials = service_account.Credentials.from_service_account_file(creds_path) | ||
| client = storage.Client(project=gcloud_project, credentials=credentials) | ||
| def set_gcp_creds(project_name: str, path_to_creds: Union[Path, str]) -> storage.Client: | ||
@@ -50,3 +58,3 @@ credentials = service_account.Credentials.from_service_account_file(path_to_creds) | ||
| def rename_blob(blob: storage.blob.Blob, new_name, client=client): | ||
| def rename_blob(blob: storage.blob.Blob, new_name: str, client=client): | ||
| """Renames a blob.""" | ||
@@ -53,0 +61,0 @@ # bucket_name = "your-bucket-name" |
+1
-1
| Metadata-Version: 2.1 | ||
| Name: apteryx | ||
| Version: 1.0.8 | ||
| Version: 1.0.9 | ||
| Summary: Utilities and useful things for Apteryx Labs | ||
@@ -5,0 +5,0 @@ License: MIT |
+1
-1
@@ -7,3 +7,3 @@ [build-system] | ||
| name = "apteryx" | ||
| version = "1.0.8" | ||
| version = "1.0.9" | ||
| description = "Utilities and useful things for Apteryx Labs" | ||
@@ -10,0 +10,0 @@ authors = [ "apteryxlabs <matthew@apteryxlabs.com>",] |
+1
-1
@@ -23,3 +23,3 @@ # -*- coding: utf-8 -*- | ||
| 'name': 'apteryx', | ||
| 'version': '1.0.8', | ||
| 'version': '1.0.9', | ||
| 'description': 'Utilities and useful things for Apteryx Labs', | ||
@@ -26,0 +26,0 @@ 'long_description': None, |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
6443
6.55%13
8.33%134
10.74%