Skip to content

Commit

Permalink
Add Connection: close header to all requests to www.reddit.com
Browse files Browse the repository at this point in the history
  • Loading branch information
bboe committed May 29, 2020
1 parent 376d735 commit bb0e000
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
16 changes: 12 additions & 4 deletions CHANGES.rst
Expand Up @@ -4,13 +4,21 @@ Change Log
prawcore follows `semantic versioning <http://semver.org/>`_ with the exception
that deprecations will not be announced by a minor release.

Unreleased
----------

1.4.0 (2020-05-28)
------------------

**Added**

When calling :meth:`.Session.request`, we add the key-value pair
``"api_type": "json"`` to the ``json`` parameter, if it is a ``dict``.
* When calling :meth:`.Session.request`, we add the key-value pair
``"api_type": "json"`` to the ``json`` parameter, if it is a ``dict``.

**Changed**

* (Non-breaking) Requests to ``www.reddit.com`` use the ``Connection: close``
header to avoid warnings when tokens are refreshed after their one-hour
expiration.


1.3.0 (2020-04-23)
------------------
Expand Down
6 changes: 5 additions & 1 deletion prawcore/auth.py
Expand Up @@ -26,7 +26,11 @@ def __init__(self, requestor, client_id, redirect_uri=None):

def _post(self, url, success_status=codes["ok"], **data):
response = self._requestor.request(
"post", url, auth=self._auth(), data=sorted(data.items())
"post",
url,
auth=self._auth(),
data=sorted(data.items()),
headers={"Connection": "close"},
)
if response.status_code != success_status:
raise ResponseException(response)
Expand Down
2 changes: 1 addition & 1 deletion prawcore/const.py
@@ -1,7 +1,7 @@
"""Constants for the prawcore package."""
import os

__version__ = "1.3.0"
__version__ = "1.4.0"

ACCESS_TOKEN_PATH = "/api/v1/access_token"
AUTHORIZATION_PATH = "/api/v1/authorize"
Expand Down

0 comments on commit bb0e000

Please sign in to comment.