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.
2 parents 0832a01 + caf7905 commit 06dea5eCopy full SHA for 06dea5e
ipinfo/details.py
@@ -12,13 +12,13 @@ def __init__(self, details):
12
13
def __getattr__(self, attr):
14
"""Return attribute if it exists in details array, else return error."""
15
- if attr in self.details:
16
- return self.details[attr]
17
- else:
+ if attr not in self.details:
18
raise AttributeError(
19
- "{} is not a valid attribute of Details".format(attr)
+ f"{attr} is not a valid attribute of Details"
20
)
21
+ return self.details[attr]
+
22
@property
23
def all(self):
24
"""Return all details as dict."""
0 commit comments