From 9b7cca5b8de86db195cd8954d53751a8ac1da9fb Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Thu, 18 May 2023 03:54:10 +0000 Subject: automatic import of python-url-parser --- .gitignore | 1 + python-url-parser.spec | 279 +++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 281 insertions(+) create mode 100644 python-url-parser.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..a97c984 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/url_parser-3.0.3.tar.gz diff --git a/python-url-parser.spec b/python-url-parser.spec new file mode 100644 index 0000000..186d253 --- /dev/null +++ b/python-url-parser.spec @@ -0,0 +1,279 @@ +%global _empty_manifest_terminate_build 0 +Name: python-url-parser +Version: 3.0.3 +Release: 1 +Summary: Parse url and get all the different parts out of it +License: MIT +URL: https://github.com/AdaptedAS/url_parser +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/7f/96/e75d719350fbbbba3fbc7b85f6d960c06367f7201a256bab7f0b4fa966bc/url_parser-3.0.3.tar.gz +BuildArch: noarch + + +%description +# Python URL Parser +![PyPI - Format](https://img.shields.io/pypi/format/url-parser) +![PyPI - Status](https://img.shields.io/pypi/status/url-parser) +![Downloads](https://pepy.tech/badge/url-parser) +![PyPI - Python Version](https://img.shields.io/pypi/pyversions/url-parser) + +A nice package to help you parse all types of URL's in vanilla python and return the parsed URL in groups.
+ +To not brake the API `parse_url` (returns a dict) still works and we made `get_url` to get the url parts as as object instead. + +In version 2.1 we also included `get_basic_url` a small yet neat function to get a the main url back from a string + +### Installation +``` +pip install url-parser +``` + +### Usage + +```python +from url_parser import parse_url, get_url, get_base_url + + +url = parse_url('https://open.prospecta.app/my_user_login?user=url-parser&password=H3ll0') # returns url sections as a dict +url_object = get_url('https://open.prospecta.app/my_user_login?user=url-parser&password=H3ll0') # Does the same, bur returns a object +basic_url = get_base_url('https://open.prospecta.app/my_user_login?user=url-parser&password=H3ll0') # Returns just the main url + +print(url['domain']) # Outputs -> prospecta +print(url_object.domain) # Outputs -> prospecta +print(basic_url) # Outputs -> https://open.prospecta.app +``` + +### Keywords `get_url` and `parse_url` + +When using the `parse_url` and `get_url` function, you get a dict (parse_url) or object (get_url) back with different parts of the URL. + +The different parts can be accessed by keywords:
+For `parse_url` use: `result['top_domain]`
+For `get_url` use: `result.top_domain` + + +Here is a list of all the available keywords: + +| Keyword | Desription | Value when not present in URL +| ------ | ------ | ------ | +| protocol | The protocol, e.g. **https** or **ftp** | None +| www | Returns **www** if www is used in the URL | None +| sub_domain | The sub domain, e.g. **my.subdomain** in **my.subdomain.example.com**. Note that the sub domain also includes www. | None +| domain | The domain, e.g. **example** in **example.com** | Is always present +| top_domain | The domain, e.g. **com** in **example.com** | Is always present +| dir | The directory, e.g. **/my/directory/** in **example.com/my/directory/** | None +| file | The file, e.g. **my_file.js** in **example.com/home/my_file.js** | None +| path | The full path, e.g. **/home/my_file.js** in **example.com/home/my_file.js** | None +| fragment | The URL fragment, e.g. **my_link** in **example.com#my_link** | None +| query | The URL query, e.g. **my_parameter=1&foo=bar** in **example.com?my_parameter=1&foo=bar** | None + +### Testing + +Use the following command to run tests. + +```bash +python -m unittest url_parser.tests.test_url_parser +``` + +### Changelog: + +See CHANGELOG.md + + + + +%package -n python3-url-parser +Summary: Parse url and get all the different parts out of it +Provides: python-url-parser +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-url-parser +# Python URL Parser +![PyPI - Format](https://img.shields.io/pypi/format/url-parser) +![PyPI - Status](https://img.shields.io/pypi/status/url-parser) +![Downloads](https://pepy.tech/badge/url-parser) +![PyPI - Python Version](https://img.shields.io/pypi/pyversions/url-parser) + +A nice package to help you parse all types of URL's in vanilla python and return the parsed URL in groups.
+ +To not brake the API `parse_url` (returns a dict) still works and we made `get_url` to get the url parts as as object instead. + +In version 2.1 we also included `get_basic_url` a small yet neat function to get a the main url back from a string + +### Installation +``` +pip install url-parser +``` + +### Usage + +```python +from url_parser import parse_url, get_url, get_base_url + + +url = parse_url('https://open.prospecta.app/my_user_login?user=url-parser&password=H3ll0') # returns url sections as a dict +url_object = get_url('https://open.prospecta.app/my_user_login?user=url-parser&password=H3ll0') # Does the same, bur returns a object +basic_url = get_base_url('https://open.prospecta.app/my_user_login?user=url-parser&password=H3ll0') # Returns just the main url + +print(url['domain']) # Outputs -> prospecta +print(url_object.domain) # Outputs -> prospecta +print(basic_url) # Outputs -> https://open.prospecta.app +``` + +### Keywords `get_url` and `parse_url` + +When using the `parse_url` and `get_url` function, you get a dict (parse_url) or object (get_url) back with different parts of the URL. + +The different parts can be accessed by keywords:
+For `parse_url` use: `result['top_domain]`
+For `get_url` use: `result.top_domain` + + +Here is a list of all the available keywords: + +| Keyword | Desription | Value when not present in URL +| ------ | ------ | ------ | +| protocol | The protocol, e.g. **https** or **ftp** | None +| www | Returns **www** if www is used in the URL | None +| sub_domain | The sub domain, e.g. **my.subdomain** in **my.subdomain.example.com**. Note that the sub domain also includes www. | None +| domain | The domain, e.g. **example** in **example.com** | Is always present +| top_domain | The domain, e.g. **com** in **example.com** | Is always present +| dir | The directory, e.g. **/my/directory/** in **example.com/my/directory/** | None +| file | The file, e.g. **my_file.js** in **example.com/home/my_file.js** | None +| path | The full path, e.g. **/home/my_file.js** in **example.com/home/my_file.js** | None +| fragment | The URL fragment, e.g. **my_link** in **example.com#my_link** | None +| query | The URL query, e.g. **my_parameter=1&foo=bar** in **example.com?my_parameter=1&foo=bar** | None + +### Testing + +Use the following command to run tests. + +```bash +python -m unittest url_parser.tests.test_url_parser +``` + +### Changelog: + +See CHANGELOG.md + + + + +%package help +Summary: Development documents and examples for url-parser +Provides: python3-url-parser-doc +%description help +# Python URL Parser +![PyPI - Format](https://img.shields.io/pypi/format/url-parser) +![PyPI - Status](https://img.shields.io/pypi/status/url-parser) +![Downloads](https://pepy.tech/badge/url-parser) +![PyPI - Python Version](https://img.shields.io/pypi/pyversions/url-parser) + +A nice package to help you parse all types of URL's in vanilla python and return the parsed URL in groups.
+ +To not brake the API `parse_url` (returns a dict) still works and we made `get_url` to get the url parts as as object instead. + +In version 2.1 we also included `get_basic_url` a small yet neat function to get a the main url back from a string + +### Installation +``` +pip install url-parser +``` + +### Usage + +```python +from url_parser import parse_url, get_url, get_base_url + + +url = parse_url('https://open.prospecta.app/my_user_login?user=url-parser&password=H3ll0') # returns url sections as a dict +url_object = get_url('https://open.prospecta.app/my_user_login?user=url-parser&password=H3ll0') # Does the same, bur returns a object +basic_url = get_base_url('https://open.prospecta.app/my_user_login?user=url-parser&password=H3ll0') # Returns just the main url + +print(url['domain']) # Outputs -> prospecta +print(url_object.domain) # Outputs -> prospecta +print(basic_url) # Outputs -> https://open.prospecta.app +``` + +### Keywords `get_url` and `parse_url` + +When using the `parse_url` and `get_url` function, you get a dict (parse_url) or object (get_url) back with different parts of the URL. + +The different parts can be accessed by keywords:
+For `parse_url` use: `result['top_domain]`
+For `get_url` use: `result.top_domain` + + +Here is a list of all the available keywords: + +| Keyword | Desription | Value when not present in URL +| ------ | ------ | ------ | +| protocol | The protocol, e.g. **https** or **ftp** | None +| www | Returns **www** if www is used in the URL | None +| sub_domain | The sub domain, e.g. **my.subdomain** in **my.subdomain.example.com**. Note that the sub domain also includes www. | None +| domain | The domain, e.g. **example** in **example.com** | Is always present +| top_domain | The domain, e.g. **com** in **example.com** | Is always present +| dir | The directory, e.g. **/my/directory/** in **example.com/my/directory/** | None +| file | The file, e.g. **my_file.js** in **example.com/home/my_file.js** | None +| path | The full path, e.g. **/home/my_file.js** in **example.com/home/my_file.js** | None +| fragment | The URL fragment, e.g. **my_link** in **example.com#my_link** | None +| query | The URL query, e.g. **my_parameter=1&foo=bar** in **example.com?my_parameter=1&foo=bar** | None + +### Testing + +Use the following command to run tests. + +```bash +python -m unittest url_parser.tests.test_url_parser +``` + +### Changelog: + +See CHANGELOG.md + + + + +%prep +%autosetup -n url-parser-3.0.3 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-url-parser -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Thu May 18 2023 Python_Bot - 3.0.3-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..f141bd6 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +f029e81cac25d60913ff89e3fb51cbb8 url_parser-3.0.3.tar.gz -- cgit v1.2.3