Skip to content

Commit 71bd2d2

Browse files
Merge pull request #12 from JohnMachado11/auth-func-compute-func-call
Cleanup on compute func call. Test with int return on compute func
2 parents 71bef4b + abebf9a commit 71bd2d2

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

Python/cloud_functions/Auth_Func/src/utils/compute_caller.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,21 @@
66

77

88
def call_compute_func():
9+
"""
10+
Calls the Cloud Function "Compute_Func"
11+
:return: *** Placeholder
12+
"""
913

1014
url = cf_url[0]
1115

12-
# response = requests.get(url)
13-
14-
# print(response.text)
15-
# print(response.status_code)
16-
17-
# return response
18-
# req = urllib.request.Request(endpoint)
19-
2016
req = urllib.request.Request(url)
2117
auth_req = google.auth.transport.requests.Request()
2218
id_token = google.oauth2.id_token.fetch_id_token(auth_req, url)
23-
# id_token = google.oauth2.id_token.fetch_id_token(auth_req, audience)
2419

2520
req.add_header("Authorization", f"Bearer {id_token}")
2621
response = urllib.request.urlopen(req)
2722

28-
return response.read()
23+
print("Datatype: ")
24+
print(type(response.read()))
25+
26+
return response.read()

Python/cloud_functions/Compute_Func/src/main.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
def main(request):
44

5-
text = "Compute Function is called!"
5+
print("Compute Function Called!")
66

7-
return text
7+
num_a = 5
8+
num_b = 5
9+
10+
num_c = num_a + num_b
11+
12+
return num_c

0 commit comments

Comments
 (0)