生成可读的url,如twitch的片段
sentence-url的Python项目详细描述
句子url
npm包readable-url的端口,用于生成可读的随机短语以添加到动态生成的url。
生成可读的url,比如twitch的片段。
示例:https://clips.twitch.tv/WiseAcceptableSnoodPupper
开始
要安装:
pip install readable-url
要导入:
from sentence-url import SentenceURL
使用说明
"""
Takes 3 parameters.
1. An integer value - The number of words to be generated in the string. (Between 2 and 10).
2. A boolean value - If true, returns string in CamelCase, else lowercase.
3. A string - The seperator between the words.
"""
generator = SentenceURL() # 3, True, '' are the default values.
#generator = SentenceURL(False, 5, '-') # Other options.
生成随机短语:
url = generator.generate()
print(url); # Prints out 'ForgetfulHarshEgg'
这可用于添加到URL的结尾。
示例:https://example.com/photos/ForgetfulHarshEgg
为了获得最佳结果,请使用3、4或5的整数值。