diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..ed374f5849d40062186e12542984ec80c98cc82e --- /dev/null +++ b/LICENSE @@ -0,0 +1,30 @@ +Build Amazing Things. + +*** + +### Unlicense + +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to . \ No newline at end of file diff --git a/README.en.md b/README.en.md deleted file mode 100644 index ae7f0c0a0c3771deb36eca2cc554cd23525683f5..0000000000000000000000000000000000000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# python-furl - -#### Description -URL manipulation made simple. - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md index 413e9600dad9569c0779a213a0226f5dba999aa8..89723da1fb7ce1847f575ab733571f947412d4fa 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,128 @@ -# python-furl +

+ furl +

-#### 介绍 -URL manipulation made simple. +

+ + + + + + + + + + + + +

-#### 软件架构 -软件架构说明 +### furl is a small Python library that makes parsing and manipulating URLs easy. +Python's standard [urllib](https://docs.python.org/2/library/urllib.html) and +[urlparse](https://docs.python.org/2/library/urlparse.html) modules provide a +number of URL\ +related functions, but using these functions to perform common +URL\ +operations proves tedious. Furl makes parsing and manipulating URLs\ +easy. -#### 安装教程 +Furl is well tested, [Unlicensed](http://unlicense.org/) in the public domain, +and supports\ +Python 2, Python 3, PyPy2, and PyPy3. -1. xxxx -2. xxxx -3. xxxx +Code time: Query arguments are easy. Really easy. -#### 使用说明 +```python +>>> from furl import furl +>>> f = furl('http://www.google.com/?one=1&two=2') +>>> f.args['three'] = '3' +>>> del f.args['one'] +>>> f.url +'http://www.google.com/?two=2&three=3' +``` -1. xxxx -2. xxxx -3. xxxx +Or use furl's inline modification methods. -#### 参与贡献 +```python +>>> furl('http://www.google.com/?one=1').add({'two':'2'}).url +'http://www.google.com/?one=1&two=2' -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request +>>> furl('http://www.google.com/?one=1&two=2').set({'three':'3'}).url +'http://www.google.com/?three=3' +>>> furl('http://www.google.com/?one=1&two=2').remove(['one']).url +'http://www.google.com/?two=2' +``` -#### 码云特技 +Encoding is handled for you. Unicode, too. -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 -5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +```python +>>> f = furl('http://www.google.com/') +>>> f.path = 'some encoding here' +>>> f.args['and some encoding'] = 'here, too' +>>> f.url +'http://www.google.com/some%20encoding%20here?and+some+encoding=here,+too' +>>> f.set(host=u'ドメイン.テスト', path=u'джк', query=u'☃=☺') +>>> f.url +'http://xn--eckwd4c7c.xn--zckzah/%D0%B4%D0%B6%D0%BA?%E2%98%83=%E2%98%BA' +``` + +Fragments also have a path and a query. + +```python +>>> f = furl('http://www.google.com/') +>>> f.fragment.path.segments = ['two', 'directories'] +>>> f.fragment.args = {'one': 'argument'} +>>> f.url +'http://www.google.com/#two/directories?one=argument' +``` + +Or get fancy. + +```python +>>> f = furl('http://www.google.com/search?q=query#1') +>>> f.copy().remove(path=True).set(host='taco.com') +... .join('/pumps.html').add(fragment_path='party').asdict() +{ 'url': 'http://taco.com/pumps.html#party', + 'scheme': 'http', + 'username': None, + 'password': None, + 'host': 'taco.com', + 'host_encoded': 'taco.com', + 'port': 80, + 'netloc': 'taco.com', + 'origin': 'http://taco.com', + 'path': { 'encoded': '/pumps.html', + 'isabsolute': True, + 'isdir': False, + 'isfile': True, + 'segments': ['pumps.html']}, + 'query': { 'encoded': '', + 'params': []}, + 'fragment': { 'encoded': 'party', + 'path': { 'encoded': 'party', + 'isabsolute': False, + 'isdir': False, + 'isfile': True, + 'segments': ['party']}, + 'query': { 'encoded': '', + 'params': []}, + 'separator': True}, } + +``` + + +### API + +See more furl magic and examples in furl's API document, +[API.md](https://github.com/gruns/furl/blob/master/API.md). + + +### Installation + +Installing furl with pip is easy. + +``` +$ pip install furl +``` diff --git a/furl-1.2.tar.gz b/furl-1.2.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..6558f36ad04cebee594a7ecc0edda6d02ca49088 Binary files /dev/null and b/furl-1.2.tar.gz differ diff --git a/python-furl.spec b/python-furl.spec new file mode 100644 index 0000000000000000000000000000000000000000..7e354ca6dcb864f3bc1f8c07a93a7e881d7a3c5b --- /dev/null +++ b/python-furl.spec @@ -0,0 +1,50 @@ +%{?python_enable_dependency_generator} +%global modname furl +Name: python-%{modname} +Version: 1.2 +Release: 1 +Summary: URL manipulation made simple +License: Unlicense +URL: https://github.com/gruns/furl +Source0: https://github.com/gruns/furl/archive/v1.2/furl-1.2.tar.gz +BuildArch: noarch +%description +%{summary}. This module let you access and modify the components (parts) of a +URL like scheme (http, https), host, port. +%package -n python3-%{modname} +Summary: %{summary} +%{?python_provide:%python_provide python3-%{modname}} +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-six >= 1.8.0 +BuildRequires: python3-orderedmultidict >= 1.0 + +%description -n python3-%{modname} +%{summary}. This module let you access and modify the components (parts) of a +URL like scheme (http, https), host, port. + +Python 3 version. + +%prep +%autosetup -n %{modname}-%{version} +sed -i -e "s/'flake8', //" setup.py + +%build +%py3_build + +%install +%py3_install + +%check +touch tests/__init__.py +%{__python3} setup.py test + +%files -n python3-%{modname} +%license LICENSE.md +%doc API.md README.md changelog.txt +%{python3_sitelib}/%{modname}-*.egg-info/ +%{python3_sitelib}/%{modname}/ + +%changelog +* Thu Jul 22 2021 anyunhao - 1.2-1 +- Package init