Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ozregistry.azurecr.io/ozone-public-registry/ozoneprod/python:3.8-slim-buster
FROM blrdbharbor.ozonecloud.ai/ozone-public-registry/ozoneprod/python:3.8-slim-buster
WORKDIR /app
COPY . .
RUN pip3 install -U pip
Expand Down
42 changes: 10 additions & 32 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,21 @@
@newrelic.agent.wsgi_application()
@app.route('/', methods=['GET', 'POST'])
def index():
n = random.random()
if n > 0.95:
raise Exception("unknown exception occured")
newrelic.agent.notice_error()
return Response(
response=json.dumps({'error': "unknown exception happened"}),
mimetype='application/json',
status=500
)
else:
print("success")
return Response(
response=json.dumps({'value': 11}),
mimetype='application/json'
)
return Response(
response=json.dumps({"welcome": "to ozone onboarding", 'value': "ozone-python-hello-world application"}),
mimetype='application/json'
)


@newrelic.agent.wsgi_application()
@app.route('/hello', methods=['GET', 'POST'])
def hello():
n = random.random()
if n > 0.98:
raise Exception("unknown exception occured")
print("unknown exception occured")
newrelic.agent.notice_error()
return Response(
response=json.dumps({'error': "unknown exception happened"}),
mimetype='application/json',
status=500
)
else:
print("success")
return Response(
response=json.dumps(
{"route": "/hello", "response": "hello world main branch"}),
mimetype='application/json'
)
print("success")
return Response(
response=json.dumps(
{"route": "/hello", "response": "hello world main branch"}),
mimetype='application/json'
)


if __name__ == "__main__":
Expand Down