This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def deep_get(data:dict[str,Any], keys:list[str]): | |
| try: | |
| key = keys[0] | |
| except IndexError: | |
| return data | |
| try: | |
| return deep_get(data[key], keys[1:]) | |
| except (KeyError,TypeError): | |
| return None | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from google.cloud.scheduler import CloudSchedulerClient | |
| def create_job(project_id: str, region: str, job_name: str, http_target: str): | |
| """ | |
| Create a job with the name in job_name invoking the url in http_target every one minute | |
| """ | |
| client = CloudSchedulerClient() | |
| location_path = client.location_path(project_id, region) | |
| job_path = client.job_path(project_id, region, job_name) |