Skip to content

Commit 16dce1c

Browse files
committed
update dockerfile and yml
x
1 parent 1534deb commit 16dce1c

File tree

3 files changed

+24
-41
lines changed

3 files changed

+24
-41
lines changed

server/djangoapp/.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
backend_url=http://127.0.0.1:3030
2-
sentiment_analyzer_url=http://127.0.0.1:5050/
1+
backend_url=https://abreu760-3030.theiadockernext-0-labs-prod-theiak8s-4-tor01.proxy.cognitiveclass.ai
2+
sentiment_analyzer_url=https://sentianalyzer.21nvmm8tsxe7.us-south.codeengine.appdomain.cloud

server/djangoapp/restapis.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@
1111

1212

1313
def get_request(endpoint, **kwargs):
14-
"""Perform a GET request to the backend service.
15-
16-
endpoint: string path starting with '/'
17-
kwargs: optional query parameters (will be passed as params to requests)
18-
Returns parsed JSON on success, or None on failure.
19-
"""
20-
request_url = backend_url + endpoint
21-
print(f"GET from {request_url} params={kwargs}")
14+
params = ""
15+
if(kwargs):
16+
for key,value in kwargs.items():
17+
params=params+key+"="+value+"&"
18+
19+
request_url = backend_url+endpoint+"?"+params
20+
21+
print("GET from {} ".format(request_url))
2222
try:
23-
response = requests.get(request_url, params=kwargs or None, timeout=10)
24-
response.raise_for_status()
23+
# Call get method of requests library with URL and parameters
24+
response = requests.get(request_url)
2525
return response.json()
26-
except requests.exceptions.RequestException as err:
27-
print(f"Network exception occurred: {err}")
28-
return None
26+
except:
27+
# If any error occurs
28+
print("Network exception occurred")
2929

3030
# def analyze_review_sentiments(text):
3131
# request_url = sentiment_analyzer_url+"analyze/"+text

server/frontend/package-lock.json

Lines changed: 9 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)