File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,18 @@ class RequestError(Exception):
2525 More detailed exception that returns the requests object. Along
2626 with some attributes with specific details from the requests
2727 object.
28+
29+ :Example:
30+
31+ >>> try:
32+ ... nb.dcim.devices.create({'name': 'destined-for-failure'})
33+ ... except pynetbox.RequestError as e:
34+ ... print(e.error)
35+ ...
36+ {"device_role":["This field is required."]}
37+
38+
39+
2840 """
2941 def __init__ (self , message ):
3042 req = message
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ def __getattr__(self, k):
7676 if self .has_details is False and k != 'keys' :
7777 if self .full_details ():
7878 ret = getattr (self , k , None )
79- if ret :
79+ if ret or hasattr ( self , k ) :
8080 return ret
8181
8282 raise AttributeError ('object has no attribute "{}"' .format (k ))
You can’t perform that action at this time.
0 commit comments