-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30bfccc
commit bec6f29
Showing
3 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from __future__ import absolute_import, print_function | ||
|
||
from urllib.parse import urljoin as base_urljoin | ||
|
||
|
||
def urljoin(*args): | ||
if len(args) < 2: | ||
raise AssertionError(f'len(args) must greater or equal than 2') | ||
|
||
base: str = args[0] if args[0][-1] == '/' else f'{args[0]}/' | ||
if len(args) > 2: | ||
result = urljoin(base_urljoin(base, str(args[1])), *args[2:]) | ||
else: | ||
result = base_urljoin(base, args[1]) | ||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters