We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 88cf8c5 commit 60fdb9cCopy full SHA for 60fdb9c
ipinfo/handler_utils.py
@@ -96,14 +96,19 @@ def read_coords(location):
96
return lat, lon
97
98
99
-def read_json_file(json_file, default_value=None):
+def read_json_file(json_file):
100
try:
101
- json_file = os.path.join(os.path.dirname(__file__), json_file)
102
- with open(json_file, encoding="utf8") as f:
+ if not json_file:
+ return None
103
+ json_file_path = os.path.join(os.path.dirname(__file__), json_file)
104
+ with open(json_file_path, encoding="utf8") as f:
105
json_data = f.read()
106
+ if not json_data:
107
108
return json.loads(json_data)
109
+
110
except FileNotFoundError:
- return default_value
111
112
113
114
def return_or_fail(raise_on_fail, e, v):
0 commit comments