File tree Expand file tree Collapse file tree 4 files changed +54
-0
lines changed Expand file tree Collapse file tree 4 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 1+ runtime : python37
2+
Original file line number Diff line number Diff line change 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+
Original file line number Diff line number Diff line change 1+ flask == 2.0.2
2+ requests == 2.26.0
You can’t perform that action at this time.
0 commit comments