Skip to content

Commit

Permalink
Merge pull request #22 from praw-dev/cleanup
Browse files Browse the repository at this point in the history
General cleanup
  • Loading branch information
LilSpazJoekp committed Jun 14, 2021
2 parents 645db15 + 6ba4ea9 commit ae48c7e
Show file tree
Hide file tree
Showing 20 changed files with 142 additions and 131 deletions.
4 changes: 2 additions & 2 deletions AUTHORS.rst
Expand Up @@ -2,8 +2,8 @@ Maintainers
===========

- Joel Payne <lilspazjoekp@gmail.com> `@LilSpazJoekp <https://github.com/LilSpazJoekp>`_
- Vikramaditya Gaonkar <vikramaditya91@gmail.com> `@vikramaditya91 <https://github.com/vikramaditya91>`_

- Vikramaditya Gaonkar <vikramaditya91@gmail.com> `@vikramaditya91
<https://github.com/vikramaditya91>`_

Contributors
============
Expand Down
40 changes: 20 additions & 20 deletions CHANGES.rst
Expand Up @@ -9,47 +9,47 @@ Unreleased

**Fixed**

* Fix ``RuntimeWarning`` when executing pre/post refresh token callbacks.
- Fix ``RuntimeWarning`` when executing pre/post refresh token callbacks.

2.0.0 (2021-02-23)
------------------

**Added**

* ``Authorizer`` optionally takes a ``pre_refresh_callback`` keyword
argument. If provided, the function will called with the instance of
``Authorizer`` prior to refreshing the access and refresh tokens.
* ``Authorizer`` optionally takes a ``post_refresh_callback`` keyword
argument. If provided, the function will called with the instance of
``Authorizer`` after refreshing the access and refresh tokens.
- ``Authorizer`` optionally takes a ``pre_refresh_callback`` keyword argument. If
provided, the function will called with the instance of ``Authorizer`` prior to
refreshing the access and refresh tokens.
- ``Authorizer`` optionally takes a ``post_refresh_callback`` keyword argument. If
provided, the function will called with the instance of ``Authorizer`` after
refreshing the access and refresh tokens.

**Changed**

* The ``refresh_token`` argument to ``Authorizer`` must now be passed by
keyword, and cannot be passed as a positional argument.
- The ``refresh_token`` argument to ``Authorizer`` must now be passed by keyword, and
cannot be passed as a positional argument.

1.5.1 (2021-01-25)
------------------

**Changed**

* Improved preprocessing for ``data`` and ``params`` in ``Session.request()``.
- Improved preprocessing for ``data`` and ``params`` in ``Session.request()``.

1.5.0 (2020-09-28)
------------------

**Changed**

* Added preprocessing for ``data`` and ``params`` in ``asyncprawcore.Session.request()``
- Added preprocessing for ``data`` and ``params`` in ``asyncprawcore.Session.request()``
for compatibility with ``aiohttp``.

**Fixed**

* Keys with a ``None`` value in the ``data`` or ``params`` parameters for
- Keys with a ``None`` value in the ``data`` or ``params`` parameters for
``asyncprawcore.Session.request()`` are now dropped as
``aiohttp.ClientSession.request()`` does not accept ``None`` values in ``data`` and
``params``.
* Keys with a boolean value in the ``params`` parameter for
- Keys with a boolean value in the ``params`` parameter for
``asyncprawcore.Session.request()`` are now casted to a string as
``aiohttp.ClientSession.request()`` does not accept boolean values in ``params``.

Expand All @@ -58,22 +58,22 @@ Unreleased

**Fixed**

* How files are handled. ``data`` is now able to be passed with ``files`` since
- How files are handled. ``data`` is now able to be passed with ``files`` since
asyncpraw can make requests with both parameters.
* Fixed ``SpecialException`` not able to get ``response.json()`` since it is a
- Fixed ``SpecialException`` not able to get ``response.json()`` since it is a
coroutine.

1.4.0.post1 (2020-07-03)
------------------------

**Fixed**

* Documentation errors.
* ``authorize_url`` will correctly return a ``str`` instead of ``yarl.URL()``.
- Documentation errors.
- ``authorize_url`` will correctly return a ``str`` instead of ``yarl.URL()``.

1.4.0 (2020-06-20)
------------------

* Converted from ``requests`` to ``aiohttp`` for asynchronous operation.
* Updated upto version 1.4.0 of prawcore.
* Forked from `praw-dev/prawcore <https://github.com/praw-dev/prawcore>`_
- Converted from ``requests`` to ``aiohttp`` for asynchronous operation.
- Updated upto version 1.4.0 of prawcore.
- Forked from `praw-dev/prawcore <https://github.com/praw-dev/prawcore>`_
56 changes: 28 additions & 28 deletions README.rst
Expand Up @@ -4,18 +4,20 @@ asyncprawcore
=============

.. image:: https://img.shields.io/pypi/v/asyncprawcore.svg
:alt: Latest asyncprawcore Version
:target: https://pypi.python.org/pypi/asyncprawcore
:alt: Latest asyncprawcore Version
:target: https://pypi.python.org/pypi/asyncprawcore

.. image:: https://img.shields.io/pypi/pyversions/asyncprawcore
:alt: Supported Python Versions
:target: https://pypi.python.org/pypi/asyncprawcore
:alt: Supported Python Versions
:target: https://pypi.python.org/pypi/asyncprawcore

.. image:: https://coveralls.io/repos/github/praw-dev/asyncprawcore/badge.svg?branch=master
:alt: Coveralls Coverage
:target: https://coveralls.io/github/praw-dev/asyncprawcore?branch=master
.. image:: https://github.com/praw-dev/asyncprawcore/workflows/CI/badge.svg
:alt: Github Actions Coverage
:target: https://github.com/praw-dev/asyncprawcore/actions?query=branch%3Amaster
:alt: Coveralls Coverage
:target: https://coveralls.io/github/praw-dev/asyncprawcore?branch=master

.. image:: https://github.com/praw-dev/asyncprawcore/workflows/CI/badge.svg
:alt: Github Actions Coverage
:target: https://github.com/praw-dev/asyncprawcore/actions?query=branch%3Amaster

asyncprawcore is a low-level communication layer for PRAW 4+.

Expand All @@ -28,14 +30,13 @@ Install asyncprawcore using ``pip`` via:
pip install asyncprawcore
Execution Example
-----------------

The following example demonstrates how to use asyncprawcore to obtain the list of
trophies for a given user using the script-app type. This example assumes you
have the environment variables ``asyncprawcore_CLIENT_ID`` and
``asyncprawcore_CLIENT_SECRET`` set to the appropriate values for your application.
trophies for a given user using the script-app type. This example assumes you have the
environment variables ``asyncprawcore_CLIENT_ID`` and ``asyncprawcore_CLIENT_SECRET``
set to the appropriate values for your application.

.. code-block:: python
Expand All @@ -44,16 +45,19 @@ have the environment variables ``asyncprawcore_CLIENT_ID`` and
import asyncio
import asyncprawcore
async def main():
authenticator = asyncprawcore.TrustedAuthenticator(
asyncprawcore.Requestor('YOUR_VALID_USER_AGENT'),
os.environ['asyncprawcore_CLIENT_ID'],
os.environ['asyncprawcore_CLIENT_SECRET'])
asyncprawcore.Requestor("YOUR_VALID_USER_AGENT"),
os.environ["asyncprawcore_CLIENT_ID"],
os.environ["asyncprawcore_CLIENT_SECRET"],
)
authorizer = asyncprawcore.ReadOnlyAuthorizer(authenticator)
await authorizer.refresh()
async with asyncprawcore.session(authorizer) as session:
pprint.pprint(await session.request('GET', '/api/v1/user/bboe/trophies'))
pprint.pprint(await session.request("GET", "/api/v1/user/bboe/trophies"))
if __name__ == "__main__":
loop = asyncio.get_event_loop()
Expand All @@ -63,21 +67,19 @@ Save the above as ``trophies.py`` and then execute via:

.. code-block:: console
python trophies.py
python trophies.py
Additional examples can be found at:
https://github.com/praw-dev/asyncprawcore/tree/master/examples


Depending on asyncprawcore
--------------------------

asyncprawcore follows `semantic versioning <http://semver.org/>`_ with the exception
that deprecations will not be preceded by a minor release. In essence, expect
only major versions to introduce breaking changes to asyncprawcore's public
interface. As a result, if you depend on asyncprawcore then it is a good idea to
specify not only the minimum version of asyncprawcore your package requires, but to
also limit the major version.
that deprecations will not be preceded by a minor release. In essence, expect only major
versions to introduce breaking changes to asyncprawcore's public interface. As a result,
if you depend on asyncprawcore then it is a good idea to specify not only the minimum
version of asyncprawcore your package requires, but to also limit the major version.

Below are two examples of how you may want to specify your asyncprawcore dependency:

Expand All @@ -86,13 +88,11 @@ setup.py

.. code-block:: python
setup(...,
install_requires=['asyncprawcore >=0.1, <1'],
...)
setup(..., install_requires=["asyncprawcore >=0.1, <1"], ...)
requirements.txt
~~~~~~~~~~~~~~~~

.. code-block:: text
asyncprawcore >=1.5.1, <2
asyncprawcore >=1.5.1, <2
2 changes: 1 addition & 1 deletion asyncprawcore/__init__.py
Expand Up @@ -4,8 +4,8 @@
from .auth import ( # noqa
Authorizer,
DeviceIDAuthorizer,
ReadOnlyAuthorizer,
ImplicitAuthorizer,
ReadOnlyAuthorizer,
ScriptAuthorizer,
TrustedAuthenticator,
UntrustedAuthenticator,
Expand Down

0 comments on commit ae48c7e

Please sign in to comment.