-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add Environment variables with dotenv - Add demo API with FlaskRestful - Add Installation guideline
- Loading branch information
1 parent
c1878ae
commit 9c6156f
Showing
4 changed files
with
74 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
__author__ = "Jay Modi" | ||
|
||
import os | ||
import requests | ||
|
||
from flask import Flask | ||
from flask_restful import Resource, Api | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() # take environment variables from .env | ||
|
||
app = Flask(__name__) | ||
api = Api(app) | ||
|
||
class HelloWorld(Resource): | ||
def get(self): | ||
return {'hello': 'world'} | ||
|
||
api.add_resource(HelloWorld, '/') | ||
|
||
|
||
if __name__ == "__main__": | ||
app.run( | ||
debug=os.getenv("DEBUG"), | ||
port=os.getenv("API_PORT") | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Utilities | ||
requests==2.25.1 | ||
python-dotenv==0.17.0 | ||
|
||
# flask | ||
Flask==1.1.2 | ||
Flask-RESTful==0.3.8 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Flask | ||
DEBUG=1 | ||
API_PORT=5000 | ||
|
||
# Opentelemetry | ||
OTEL_PYTHON_FLASK_EXCLUDED_URLS="heathcheck" |