(argv)
| 54 | |
| 55 | |
| 56 | def main(argv): |
| 57 | # Authenticate and construct service. |
| 58 | service, flags = sample_tools.init( |
| 59 | argv, |
| 60 | "coordinate", |
| 61 | "v1", |
| 62 | __doc__, |
| 63 | __file__, |
| 64 | parents=[argparser], |
| 65 | scope="https://www.googleapis.com/auth/coordinate", |
| 66 | ) |
| 67 | |
| 68 | service = build("coordinate", "v1", http=http) |
| 69 | |
| 70 | try: |
| 71 | # List all the jobs for a team |
| 72 | jobs_result = service.jobs().list(teamId=flags.teamId).execute(http=http) |
| 73 | |
| 74 | print("List of Jobs:") |
| 75 | pprint.pprint(jobs_result) |
| 76 | |
| 77 | # Multiline note |
| 78 | note = """ |
| 79 | These are notes... |
| 80 | on different lines |
| 81 | """ |
| 82 | |
| 83 | # Insert a job and store the results |
| 84 | insert_result = ( |
| 85 | service.jobs() |
| 86 | .insert( |
| 87 | body="", |
| 88 | title="Google Campus", |
| 89 | teamId=flags.teamId, |
| 90 | address="1600 Amphitheatre Parkway Mountain View, CA 94043", |
| 91 | lat="37.422120", |
| 92 | lng="122.084429", |
| 93 | assignee=None, |
| 94 | note=note, |
| 95 | ) |
| 96 | .execute() |
| 97 | ) |
| 98 | |
| 99 | pprint.pprint(insert_result) |
| 100 | |
| 101 | # Close the job |
| 102 | update_result = ( |
| 103 | service.jobs() |
| 104 | .update( |
| 105 | body="", |
| 106 | teamId=flags.teamId, |
| 107 | jobId=insert_result["id"], |
| 108 | progress="COMPLETED", |
| 109 | ) |
| 110 | .execute() |
| 111 | ) |
| 112 | |
| 113 | pprint.pprint(update_result) |
no test coverage detected
searching dependent graphs…