Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Umar/fix handler loading #73

Merged
merged 1 commit into from
Nov 23, 2022
Merged
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
9 changes: 3 additions & 6 deletions ipinfo/handler_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,11 @@ def read_coords(location):


def read_json_file(json_file):
"""
Read a list of countries from specified country file or default file.
"""
json_file = os.path.join(os.path.dirname(__file__), json_file)
with open(json_file) as f:
countries_json = f.read()
with open(json_file, encoding="utf8") as f:
json_data = f.read()

return json.loads(countries_json)
return json.loads(json_data)


def return_or_fail(raise_on_fail, e, v):
Expand Down