From 77a5660a99f79bbc0161382b347602a00a63ed41a30f3f4eafd0ce8e4fae9286 Mon Sep 17 00:00:00 2001 From: Todd R Date: Thu, 10 May 2018 03:00:32 +0000 Subject: [PATCH] Accepting request 606009 from devel:languages:python:misc Automating interaction with websites OBS-URL: https://build.opensuse.org/request/show/606009 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-MechanicalSoup?expand=0&rev=1 --- .gitattributes | 23 +++++++++ .gitignore | 1 + MechanicalSoup-0.10.0.tar.gz | 3 ++ python-MechanicalSoup.changes | 87 +++++++++++++++++++++++++++++++++++ python-MechanicalSoup.spec | 83 +++++++++++++++++++++++++++++++++ 5 files changed, 197 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 MechanicalSoup-0.10.0.tar.gz create mode 100644 python-MechanicalSoup.changes create mode 100644 python-MechanicalSoup.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/MechanicalSoup-0.10.0.tar.gz b/MechanicalSoup-0.10.0.tar.gz new file mode 100644 index 0000000..566569c --- /dev/null +++ b/MechanicalSoup-0.10.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22423efd025c3eedb06f41d3ff1127174a59f40dc560e82dce143956976195bf +size 24165 diff --git a/python-MechanicalSoup.changes b/python-MechanicalSoup.changes new file mode 100644 index 0000000..89940df --- /dev/null +++ b/python-MechanicalSoup.changes @@ -0,0 +1,87 @@ +------------------------------------------------------------------- +Thu May 10 02:51:41 UTC 2018 - toddrme2178@gmail.com + +- Update to Version 0.10 + + Main changes: + * Added ``StatefulBrowser.refresh()`` to reload the current page with the same request. + * ``StatefulBrowser.follow_link``, + ``StatefulBrowser.submit_selected()`` and the new + ``StatefulBrowser.download_link`` now sets the ``Referer:`` HTTP + header to the page from which the link is followed. + * Added method ``StatefulBrowser.download_link``, which will download the + contents of a link to a file without changing the state of the browser. + * The ``selector`` argument of ``Browser.select_form`` can now be a + `bs4.element.Tag `__ + in addition to a CSS selector. + * ``Browser.submit`` and ``StatefulBrowser.submit_selected`` accept a larger + number of keyword arguments. Arguments are forwarded to + `requests.Session.request `__. + + Internal changes: + * ``StatefulBrowser.choose_submit`` will now ignore input elements that are + missing a name-attribute instead of raising a ``KeyError``. + * Private methods ``Browser._build_request`` and ``Browser._prepare_request`` + have been replaced by a single method ``Browser._request``. +- Update to Version 0.9 + + Main changes: + * We do not rely on BeautifulSoup's default choice of HTML parser. + Instead, we now specify ``lxml`` as default. As a consequence, the + default setting requires ``lxml`` as a dependency. + * Python 2.6 and 3.3 are no longer supported. + * The GitHub URL moved from + https://github.com/hickford/MechanicalSoup/ to + https://github.com/MechanicalSoup/MechanicalSoup. @moy and + @hemberger are now officially administrators of the project in + addition to @hickford, the original author. + * We now have a documentation site: https://mechanicalsoup.readthedocs.io/. + The API is now fully documented, and we have included a tutorial, + several more code examples, and a FAQ. + * ``StatefulBrowser.select_form`` can now be called without argument, + and defaults to ``"form"`` in this case. It also has a new argument, + ``nr`` (defaults to 0), which can be used to specify the index of + the form to select if multiple forms match the selection criteria. + * We now use requirement files. You can install the dependencies of + MechanicalSoup with e.g.:: + pip install -r requirements.txt -r tests/requirements.txt + * The ``Form`` class was restructured and has a new API. The behavior of + existing code is unchanged, but a new collection of methods has been + added for clarity and consistency with the ``set`` method: + - ``set_input`` deprecates ``input`` + - ``set_textarea`` deprecates ``textarea`` + - ``set_select`` is new + - ``set_checkbox`` and ``set_radio`` together deprecate ``check`` + (checkboxes are handled differently by default) + * A new ``Form.print_summary`` method allows you to write + ``browser.get_current_form().print_summary()`` to get a summary of the + fields you need to fill-in (and which ones are already filled-in). + * The ``Form`` class now supports selecting multiple options in + a ```` + element instead of an ````. + +------------------------------------------------------------------- +Wed Oct 18 16:44:35 UTC 2017 - toddrme2178@gmail.com + +- Implement single-spec version +- Update to version 0.8.0 + * See changelog at https://github.com/MechanicalSoup/MechanicalSoup/blob/v0.8.0/docs/ChangeLog.txt + +------------------------------------------------------------------- +Mon Jul 14 10:00:11 UTC 2014 - toddrme2178@gmail.com + +- - Initial version + diff --git a/python-MechanicalSoup.spec b/python-MechanicalSoup.spec new file mode 100644 index 0000000..24b3b59 --- /dev/null +++ b/python-MechanicalSoup.spec @@ -0,0 +1,83 @@ +# +# spec file for package python-MechanicalSoup +# +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +# Tests require network connection +%bcond_with test +Name: python-MechanicalSoup +Version: 0.10.0 +Release: 0 +Summary: A Python library for automating interaction with websites +License: MIT +Group: Development/Languages/Python +Url: https://github.com/hickford/MechanicalSoup +Source: https://files.pythonhosted.org/packages/source/M/MechanicalSoup/MechanicalSoup-%{version}.tar.gz +BuildRequires: %{python_module devel} +BuildRequires: %{python_module pytest-runner} +BuildRequires: %{python_module setuptools} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +%if %{with test} +BuildRequires: %{python_module beautifulsoup4} +BuildRequires: %{python_module pytest-cov} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module requests >= 2.0} +BuildRequires: %{python_module requests-mock} +BuildRequires: %{python_module six >= 1.4} +%endif +Requires: python-beautifulsoup4 +Requires: python-requests >= 2.0 +Requires: python-six >= 1.4 +BuildArch: noarch + +%python_subpackages + +%description +A Python library for automating interaction with websites. +MechanicalSoup automatically stores and sends cookies, +follows redirects, and can follow links and submit forms. +It doesn't do Javascript. + +I was a fond user of the Mechanize library, but unfortunately +it's incompatible with Python 3 and development is inactive. +MechanicalSoup provides a similar API, built on Python giants +Requests (for http sessions) and BeautifulSoup (for document +navigation). + +%prep +%setup -q -n MechanicalSoup-%{version} + +%build +%python_build + +%install +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%if %{with test} +%check +%python_exec setup.py test +%endif + +%files %{python_files} +%defattr(-,root,root,-) +%doc README.rst +%license LICENSE +%{python_sitelib}/* + +%changelog