Skip to content

Commit 213023e

Browse files
committed
initial commit
0 parents  commit 213023e

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed

.gcloudignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This file specifies files that are *not* uploaded to Google Cloud
2+
# using gcloud. It follows the same syntax as .gitignore, with the addition of
3+
# "#!include" directives (which insert the entries of the given .gitignore-style
4+
# file at that point).
5+
#
6+
# For more information, run:
7+
# $ gcloud topic gcloudignore
8+
#
9+
.gcloudignore
10+
# If you would like to upload your .git directory, .gitignore file or files
11+
# from your .gitignore file, remove the corresponding line
12+
# below:
13+
.git
14+
.gitignore
15+
16+
# Python pycache:
17+
__pycache__/
18+
# Ignored by the build system
19+
/setup.cfg

app.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
runtime: python37
2+

main.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
3+
from flask import Flask, request # import flask and incoming request.
4+
import requests # import outgoing request
5+
6+
url = "YOUR_URL"
7+
8+
app = Flask(__name__)
9+
10+
11+
@app.get("/") #http get
12+
def get_countries():
13+
return "Hello, you requested."
14+
15+
16+
@app.post("/") #http post
17+
def https_post_to_firebase():
18+
if request.is_json:
19+
data = request.get_json() # Get requested http post data.
20+
21+
print(data)
22+
23+
response = requests.post(url, json=data) # Post requested data to https server.
24+
25+
if response.status_code == 404:
26+
print('Not Found.')
27+
28+
return data, 201 # return http 201(created) response.
29+
30+
31+

requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
flask==2.0.2
2+
requests==2.26.0

0 commit comments

Comments
 (0)