Skip to content

Conversation

@erfanul007
Copy link
Collaborator

  • Added configuration of logging
  • Updated all methods with try catch
  • Server error logging added

@erfanul007 erfanul007 linked an issue Jun 17, 2023 that may be closed by this pull request
@erfanul007 erfanul007 requested a review from smhimran June 17, 2023 16:51
@erfanul007 erfanul007 requested a review from smhimran February 1, 2025 14:13
Copy link
Owner

@smhimran smhimran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. A few improvements can be made, some of them are not urgent and we can do sometime in the (not so soon ;p) future.

ports:
- "80:80"
- "8080:80"
volumes:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? Nginx should run on docker port 80 without any errors.

return Response({'message': 'User not found'} ,status=404)
except Exception as ex:
logger.exception(ex)
return Response(status=500, data={'message': 'Some error occurred while getting user score.'})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or, you can raise the exception without having to return a 500 error. However, that's optional.


if response1.status_code != 200 or response1.json()['status'] != 'OK':
try:
response1 = requests.get("https://codeforces.com/api/user.rating?handle=" + cf_username)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should move these API requests to a different service...as an improvement of course.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erfanul007 Add a todo and an issue to move this API call and other API calls to a service. We can close the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Back-end] Add exception handling and logging

4 participants