mirror of
https://github.com/haiwen/seahub.git
synced 2025-06-04 21:11:20 +00:00
21 lines
450 B
Python
21 lines
450 B
Python
import string
|
|
import random
|
|
|
|
from .common import BASE_URL
|
|
|
|
def randstring(length=0):
|
|
if length == 0:
|
|
length = random.randint(1, 30)
|
|
return ''.join(random.choice(string.lowercase) for i in range(length))
|
|
|
|
def urljoin(base, *args):
|
|
url = base
|
|
if url[-1] != '/':
|
|
url += '/'
|
|
for arg in args:
|
|
arg = arg.strip('/')
|
|
url += arg + '/'
|
|
return url
|
|
|
|
def apiurl(*parts):
|
|
return urljoin(BASE_URL, *parts) |