Hello community,

here is the log from the commit of package python-grequests for 
openSUSE:Factory checked in at 2015-05-10 10:46:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-grequests (Old)
 and      /work/SRC/openSUSE:Factory/.python-grequests.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-grequests"

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-grequests/python-grequests.changes        
2013-10-25 11:17:26.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.python-grequests.new/python-grequests.changes   
2015-05-10 10:46:26.000000000 +0200
@@ -1,0 +2,10 @@
+Wed May  6 12:47:45 UTC 2015 - [email protected]
+
+- update to version 0.2.0:
+  * no changelog available
+- add python-requests as a runtime dependency
+- add python-gevent and python-requests as build dependencies to
+  ensure their availability
+- rename README to README.rst to follow upstream
+
+-------------------------------------------------------------------

Old:
----
  grequests-0.1.0.tar.gz

New:
----
  grequests-0.2.0.tar.gz

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

Other differences:
------------------
++++++ python-grequests.spec ++++++
--- /var/tmp/diff_new_pack.al0NMy/_old  2015-05-10 10:46:26.000000000 +0200
+++ /var/tmp/diff_new_pack.al0NMy/_new  2015-05-10 10:46:26.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-grequests
 #
-# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 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
@@ -17,7 +17,7 @@
 
 
 Name:           python-grequests
-Version:        0.1.0
+Version:        0.2.0
 Release:        0
 Summary:        Requests + Gevent
 License:        BSD-2-Clause
@@ -26,8 +26,11 @@
 Source:         
http://pypi.python.org/packages/source/g/grequests/grequests-%{version}.tar.gz
 Source1:        LICENSE
 BuildRequires:  python-devel
+BuildRequires:  python-gevent
+BuildRequires:  python-requests >= 1.0.0
 BuildRequires:  python-setuptools
 Requires:       python-gevent
+Requires:       python-requests >= 1.0.0
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 %if 0%{?suse_version} && 0%{?suse_version} <= 1110
 %{!?python_sitelib: %global python_sitelib %(python -c "from 
distutils.sysconfig import get_python_lib; print get_python_lib()")}
@@ -75,7 +78,7 @@
 
 %files
 %defattr(-,root,root,-)
-%doc README LICENSE
+%doc README.rst LICENSE
 %{python_sitelib}/*
 
 %changelog

++++++ grequests-0.1.0.tar.gz -> grequests-0.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/grequests-0.1.0/PKG-INFO new/grequests-0.2.0/PKG-INFO
--- old/grequests-0.1.0/PKG-INFO        2012-05-11 00:20:59.000000000 +0200
+++ new/grequests-0.2.0/PKG-INFO        2013-03-05 00:12:31.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: grequests
-Version: 0.1.0
+Version: 0.2.0
 Summary: Requests + Gevent
 Home-page: https://github.com/kennethreitz/grequests
 Author: Kenneth Reitz
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/grequests-0.1.0/README.rst 
new/grequests-0.2.0/README.rst
--- old/grequests-0.1.0/README.rst      1970-01-01 01:00:00.000000000 +0100
+++ new/grequests-0.2.0/README.rst      2013-03-05 00:00:08.000000000 +0100
@@ -0,0 +1,38 @@
+GRequests: Asyncronous Requests
+===============================
+
+GRequests allows you to use Requests with Gevent to make asyncronous HTTP
+Requests easily.
+
+
+Usage
+-----
+
+Usage is simple::
+
+    import grequests
+
+    urls = [
+        'http://www.heroku.com',
+        'http://python-tablib.org',
+        'http://httpbin.org',
+        'http://python-requests.org',
+        'http://kennethreitz.com'
+    ]
+
+Create a set of unsent Requests::
+
+    >>> rs = (grequests.get(u) for u in urls)
+
+Send them all at the same time::
+
+    >>> grequests.map(rs)
+    [<Response [200]>, <Response [200]>, <Response [200]>, <Response [200]>, 
<Response [200]>]
+
+
+Installation
+------------
+
+Installation is easy with pip::
+
+    $ pip install grequests
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/grequests-0.1.0/grequests.egg-info/PKG-INFO 
new/grequests-0.2.0/grequests.egg-info/PKG-INFO
--- old/grequests-0.1.0/grequests.egg-info/PKG-INFO     2012-05-11 
00:20:59.000000000 +0200
+++ new/grequests-0.2.0/grequests.egg-info/PKG-INFO     2013-03-05 
00:12:31.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: grequests
-Version: 0.1.0
+Version: 0.2.0
 Summary: Requests + Gevent
 Home-page: https://github.com/kennethreitz/grequests
 Author: Kenneth Reitz
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/grequests-0.1.0/grequests.egg-info/SOURCES.txt 
new/grequests-0.2.0/grequests.egg-info/SOURCES.txt
--- old/grequests-0.1.0/grequests.egg-info/SOURCES.txt  2012-05-11 
00:20:59.000000000 +0200
+++ new/grequests-0.2.0/grequests.egg-info/SOURCES.txt  2013-03-05 
00:12:31.000000000 +0100
@@ -1,8 +1,9 @@
-README
+README.rst
 grequests.py
 setup.py
 grequests.egg-info/PKG-INFO
 grequests.egg-info/SOURCES.txt
 grequests.egg-info/dependency_links.txt
 grequests.egg-info/not-zip-safe
+grequests.egg-info/requires.txt
 grequests.egg-info/top_level.txt
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/grequests-0.1.0/grequests.egg-info/requires.txt 
new/grequests-0.2.0/grequests.egg-info/requires.txt
--- old/grequests-0.1.0/grequests.egg-info/requires.txt 1970-01-01 
01:00:00.000000000 +0100
+++ new/grequests-0.2.0/grequests.egg-info/requires.txt 2013-03-05 
00:12:31.000000000 +0100
@@ -0,0 +1,2 @@
+gevent
+requests>=1.0.0
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/grequests-0.1.0/grequests.py 
new/grequests-0.2.0/grequests.py
--- old/grequests-0.1.0/grequests.py    2012-05-11 00:15:24.000000000 +0200
+++ new/grequests-0.2.0/grequests.py    2013-03-05 00:00:08.000000000 +0100
@@ -8,6 +8,7 @@
 by gevent. All API methods return a ``Request`` instance (as opposed to
 ``Response``). A list of requests can be sent with ``map()``.
 """
+from functools import partial
 
 try:
     import gevent
@@ -19,7 +20,7 @@
 # Monkey-patch.
 curious_george.patch_all(thread=False, select=False)
 
-from requests import api
+from requests import Session
 
 
 __all__ = (
@@ -28,79 +29,105 @@
 )
 
 
-def patched(f):
-    """Patches a given API function to not send."""
+class AsyncRequest(object):
+    """ Asynchronous request.
 
-    def wrapped(*args, **kwargs):
+    Accept same parameters as ``Session.request`` and some additional:
 
-        kwargs['return_response'] = False
-        kwargs['prefetch'] = True
-
-        config = kwargs.get('config', {})
-        config.update(safe_mode=True)
-
-        kwargs['config'] = config
-
-        return f(*args, **kwargs)
-
-    return wrapped
+    :param session: Session which will do request
+    :param callback: Callback called on response.
+                     Same as passing ``hooks={'response': callback}``
+    """
+    def __init__(self, method, url, **kwargs):
+        #: Request method
+        self.method = method
+        #: URL to request
+        self.url = url
+        #: Associated ``Session``
+        self.session = kwargs.pop('session', None)
+        if self.session is None:
+            self.session = Session()
+
+        callback = kwargs.pop('callback', None)
+        if callback:
+            kwargs['hooks'] = {'response': callback}
+
+        #: The rest arguments for ``Session.request``
+        self.kwargs = kwargs
+        #: Resulting ``Response``
+        self.response = None
+
+    def send(self, **kwargs):
+        """
+        Prepares request based on parameter passed to constructor and optional 
``kwargs```.
+        Then sends request and saves response to :attr:`response`
+
+        :returns: ``Response``
+        """
+        merged_kwargs = {}
+        merged_kwargs.update(self.kwargs)
+        merged_kwargs.update(kwargs)
+        self.response =  self.session.request(self.method,
+                                              self.url, **merged_kwargs)
+        return self.response
 
 
-def send(r, pool=None, prefetch=False):
+def send(r, pool=None, stream=False):
     """Sends the request object using the specified pool. If a pool isn't
     specified this method blocks. Pools are useful because you can specify size
     and can hence limit concurrency."""
-
     if pool != None:
-        return pool.spawn(r.send, prefetch=prefetch)
+        return pool.spawn(r.send, stream=stream)
+
+    return gevent.spawn(r.send, stream=stream)
 
-    return gevent.spawn(r.send, prefetch=prefetch)
 
+# Shortcuts for creating AsyncRequest with appropriate HTTP method
+get = partial(AsyncRequest, 'GET')
+options = partial(AsyncRequest, 'OPTIONS')
+head = partial(AsyncRequest, 'HEAD')
+post = partial(AsyncRequest, 'POST')
+put = partial(AsyncRequest, 'PUT')
+patch = partial(AsyncRequest, 'PATCH')
+delete = partial(AsyncRequest, 'DELETE')
 
-# Patched requests.api functions.
-get = patched(api.get)
-options = patched(api.options)
-head = patched(api.head)
-post = patched(api.post)
-put = patched(api.put)
-patch = patched(api.patch)
-delete = patched(api.delete)
-request = patched(api.request)
+# synonym
+def request(method, url, **kwargs):
+    return AsyncRequest(method, url, **kwargs)
 
 
-def map(requests, prefetch=True, size=None):
+def map(requests, stream=False, size=None):
     """Concurrently converts a list of Requests to Responses.
 
     :param requests: a collection of Request objects.
-    :param prefetch: If False, the content will not be downloaded immediately.
+    :param stream: If True, the content will not be downloaded immediately.
     :param size: Specifies the number of requests to make at a time. If None, 
no throttling occurs.
     """
 
     requests = list(requests)
 
     pool = Pool(size) if size else None
-    jobs = [send(r, pool, prefetch=prefetch) for r in requests]
+    jobs = [send(r, pool, stream=stream) for r in requests]
     gevent.joinall(jobs)
 
     return [r.response for r in requests]
 
 
-def imap(requests, prefetch=True, size=2):
+def imap(requests, stream=False, size=2):
     """Concurrently converts a generator object of Requests to
     a generator of Responses.
 
     :param requests: a generator of Request objects.
-    :param prefetch: If False, the content will not be downloaded immediately.
+    :param stream: If True, the content will not be downloaded immediately.
     :param size: Specifies the number of requests to make at a time. default 
is 2
     """
 
     pool = Pool(size)
 
     def send(r):
-        r.send(prefetch)
-        return r.response
+        return r.send(stream=stream)
 
     for r in pool.imap_unordered(send, requests):
         yield r
 
-    pool.join()
\ No newline at end of file
+    pool.join()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/grequests-0.1.0/setup.py new/grequests-0.2.0/setup.py
--- old/grequests-0.1.0/setup.py        2012-05-11 00:20:48.000000000 +0200
+++ new/grequests-0.2.0/setup.py        2013-03-05 00:09:26.000000000 +0100
@@ -33,13 +33,17 @@
 
 setup(
     name='grequests',
-    version='0.1.0',
+    version='0.2.0',
     url='https://github.com/kennethreitz/grequests',
     license='BSD',
     author='Kenneth Reitz',
     author_email='[email protected]',
     description='Requests + Gevent',
     long_description=__doc__,
+    install_requires=[
+        'gevent',
+        'requests>=1.0.0'
+    ],
     py_modules=['grequests'],
     zip_safe=False,
     include_package_data=True,


Reply via email to