miniuri:通用uri解析器
miniuri的Python项目详细描述
miniuri是一个通用的uri解析器类。
只有145行python(如果计算单元测试,则为400行)。
安装
pip install miniuri
它是做什么的?
解析器授予对以下属性的访问权:
foo://username:password@test.com:808/go/to/index.php?pet=cat&name=bam#eye \_/ \_______________/ \______/ \_/ \___/ \_/ \_______________/\_/ | | | | | | | | | userinfo hostname | | | query fragment | \___________________________|/\________|____|_/ | | | | | | scheme authority | path | extension | | port filename
教程
此示例显示如何设置和获取任何uri属性:
>>>fromminiuriimportUri>>>u=Uri("http://www.foxhop.net/samsung/HL-T5087SA/red-LED-failure")>>>u.uri="https://fox:pass@www.foxhop.net:81/path/filename.jpg?p=2#5">>>print(u.uri)'https://fox:pass@www.foxhop.net:81/path/filename.jpg?p=2#5'>>>print(u.hostname)'www.foxhop.net'>>>print(u.scheme)'https'>>>u.username='max'>>>print(u)'https://max:pass@www.foxhop.net:81/path/filename.jpg?p=2#5'>>>print(u.relative_uri)'/path/filename.jpg?p=2#5'
我该怎么感谢你?
许可证
公共域