File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -280,11 +280,13 @@ def list_parser(list_item):
280
280
setattr (self , k , v )
281
281
282
282
def _endpoint_from_url (self , url ):
283
- # Remove the base URL from the beginning
284
- url = url [len (self .api .base_url ) :]
285
- if url .startswith ("/" ):
286
- url = url [1 :]
287
- app , name = urlsplit (url ).path .split ("/" )[:2 ]
283
+ url_path = urlsplit (url ).path
284
+ base_url_path_parts = urlsplit (self .api .base_url ).path .split ("/" )
285
+ if len (base_url_path_parts ) > 2 :
286
+ # There are some extra directories in the path, remove them from url
287
+ extra_path = "/" .join (base_url_path_parts [:- 1 ])
288
+ url_path = url_path [len (extra_path ) :]
289
+ app , name = url_path .split ("/" )[2 :4 ]
288
290
return getattr (pynetbox .core .app .App (self .api , app ), name )
289
291
290
292
def full_details (self ):
You can’t perform that action at this time.
0 commit comments