Skip to content

Commit

Permalink
Merge pull request #16 from Hart-House-Chess-Club/develop
Browse files Browse the repository at this point in the history
Update links for readme
  • Loading branch information
victor-zheng-codes authored Jan 6, 2024
2 parents a389eb3 + 26e64ed commit 251672c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ simply open an issue with the tag "enhancement". Don't forget to give the projec

## License

Distributed under the MIT License. See `LICENSE.txt` for more information.
Distributed under the MIT License. See `LICENSE` for more information.

<p align="right">(<a href="#readme-top">back to top</a>)</p>

Expand Down Expand Up @@ -263,11 +263,11 @@ to kick things off!

[license-shield]: https://img.shields.io/github/license/Hart-House-Chess-Club/ratings-calculator.svg?style=for-the-badge

[license-url]: https://github.com/Hart-House-Chess-Club/ratings-calculator/blob/master/LICENSE.txt
[license-url]: https://github.com/Hart-House-Chess-Club/ratings-calculator/blob/master/LICENSE

[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555

[linkedin-url]: https://linkedin.com/in/Hart-House-Chess-Club
[linkedin-url]: https://www.linkedin.com/company/Hart-House-Chess-Club/

[product-screenshot]: images/screenshot.png

12 changes: 9 additions & 3 deletions src/ratings_calculator/Profile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Class to get cfc profile information of the user"""
import json
import requests
from urllib3.exceptions import NameResolutionError

from config import Config


Expand All @@ -23,9 +25,13 @@ def initialize_profile(self) -> dict:
:return: json dictionary mapping of the player and its fields
"""
if self.web_profile:
URL = f"https://server.chess.ca/api/player/v1/{self.user_id}"
page = requests.get(URL)
return page.json()
# noinspection PyBroadException
try:
URL = f"https://server.chess.ca/api/player/v1/{self.user_id}"
page = requests.get(URL)
return page.json()
except Exception:
print("Failed to connect to API, check connection to requests library")
else:
# open the json file and place the file as the value into the page
filepath = f"../player_info_{self.user_id}.json"
Expand Down

0 comments on commit 251672c

Please sign in to comment.