Skip to content

Commit

Permalink
Merge branch 'master' into empty-files-key-multipart
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmavirus24 authored Feb 26, 2024
2 parents de21055 + c62d977 commit d9efaca
Show file tree
Hide file tree
Showing 27 changed files with 340 additions and 523 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI

on: [push, pull_request]

defaults:
run:
shell: bash

jobs:
package:
runs-on: ubuntu-latest

steps:
- name: "Checkout repository"
uses: "actions/checkout@v3"

- name: "Setup Python"
uses: "actions/setup-python@v4"
with:
python-version: "3.x"
cache: "pip"
cache-dependency-path: '**/setup.py'

- name: "Check packages"
run: |
python -m pip install -U setuptools wheel twine
python setup.py sdist bdist_wheel
python -m twine check --strict dist/*
test:
strategy:
fail-fast: false
matrix:
python-version: ["2.7", "3.7", "3.8", "3.9", "3.10", "3.11"]
os:
- macos-latest
- windows-latest
- ubuntu-latest

runs-on: ${{ matrix.os }}
name: ${{ fromJson('{"macos-latest":"macOS","windows-latest":"Windows","ubuntu-latest":"Ubuntu"}')[matrix.os] }} ${{ matrix.python-version }}
steps:
- name: "Checkout repository"
uses: "actions/checkout@v3"

- name: "Setup Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v4"
with:
python-version: ${{ matrix.python-version }}
# Fails on Python 2 + Windows
# cache: "pip"
# cache-dependency-path: '**/setup.py'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Test with tox
run: tox
78 changes: 0 additions & 78 deletions .travis.yml

This file was deleted.

4 changes: 3 additions & 1 deletion AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,6 @@ Patches and Suggestions

- Sam Bull (@greatestape)

- Florence Blanc-Renaud <[email protected]> (@flo-renaud)
- Chris van Marle (https://github.com/qistoph)

- Florence Blanc-Renaud <[email protected]> (@flo-renaud)
39 changes: 39 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
History
=======

1.0.0 -- 2023-05-01
-------------------

Breaking Changes
~~~~~~~~~~~~~~~~

- Removed Google App Engine support to allow using urllib3 2.0

Fixed Bugs
~~~~~~~~~~

- Ensured the test suite no longer reaches the Internet

Miscellaneous
~~~~~~~~~~~~~

- Added explicit support for Python 3.11

0.10.1 -- 2022-10-25
--------------------

Fixed Bugs
~~~~~~~~~~

- Fix urllib3 warning to only emit on X509Adapter usage

0.10.0 -- 2022-10-06
--------------------

New Features
~~~~~~~~~~~~

- Add support for preparing requests in BaseUrlSession

Fixed Bugs
~~~~~~~~~~

- Fixing missing newline in dump utility

0.9.1 -- 2019-01-29
-------------------

Expand Down
3 changes: 2 additions & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pytest
mock;python_version<"3.3"
pyopenssl
git+git://github.com/sigmavirus24/betamax
git+https://github.com/betamaxpy/betamax
trustme
61 changes: 4 additions & 57 deletions docs/adapters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ The toolbelt comes with several different transport adapters for you to use
with requests. The transport adapters are all kept in
:mod:`requests_toolbelt.adapters` and include

- :class:`requests_toolbelt.adapters.appengine.AppEngineAdapter`

- :class:`requests_toolbelt.adapters.fingerprint.FingerprintAdapter`

- :class:`requests_toolbelt.adapters.socket_options.SocketOptionsAdapter`
Expand All @@ -23,61 +21,6 @@ with requests. The transport adapters are all kept in

- :class:`requests_toolbelt.adapters.x509.X509Adapter`

AppEngineAdapter
----------------

.. versionadded:: 0.6.0

As of version 2.10.0, Requests will be capable of supporting Google's App
Engine platform. In order to use Requests on GAE, however, you will need a
custom adapter found here as
:class:`~requests_toolbelt.adapters.appengine.AppEngineAdapter`. There are two
ways to take advantage of this support at the moment:

#. Using the :class:`~requests_toolbelt.adapters.appengine.AppEngineAdapter`
like every other adapter, e.g.,

.. code-block:: python
import requests
from requests_toolbelt.adapters import appengine
s = requests.Session()
s.mount('http://', appengine.AppEngineAdapter())
s.mount('https://', appengine.AppEngineAdapter())
#. By monkey-patching requests to always use the provided adapter:

.. code-block:: python
import requests
from requests_toolbelt.adapters import appengine
appengine.monkeypatch()
.. _insecure_appengine:

If you should need to disable certificate validation when monkeypatching (to
force third-party libraries that use Requests to not validate certificates, if
they do not provide API surface to do so, for example), you can disable it:

.. code-block:: python
from requests_toolbelt.adapters import appengine
appengine.monkeypatch(validate_certificate=False)
.. warning::

If ``validate_certificate`` is ``False``, the monkeypatched adapter
will *not* validate certificates. This effectively sets the
``validate_certificate`` argument to urlfetch.Fetch() to ``False``. You
should avoid using this wherever possible. Details can be found in the
`documentation for urlfetch.Fetch()`_.

.. _documentation for urlfetch.Fetch(): https://cloud.google.com/appengine/docs/python/refdocs/google.appengine.api.urlfetch

.. autoclass:: requests_toolbelt.adapters.appengine.AppEngineAdapter

FingerprintAdapter
------------------

Expand Down Expand Up @@ -134,6 +77,8 @@ Requests supports SSL Verification by default. However, it relies on
the user making a request with the URL that has the hostname in it. If,
however, the user needs to make a request with the IP address, they cannot
actually verify a certificate against the hostname they want to request.
This adapter sets the `Server Name Indication`_ to, and verifies the
certificate against, the hostname in the Host header.

To accomodate this very rare need, we've added
:class:`~requests_toolbelt.adapters.host_header_ssl.HostHeaderSSLAdapter`.
Expand All @@ -149,6 +94,8 @@ Example usage:
.. autoclass:: requests_toolbelt.adapters.host_header_ssl.HostHeaderSSLAdapter

.. _Server Name Indication: https://en.wikipedia.org/wiki/Server_Name_Indication

SourceAddressAdapter
--------------------

Expand Down
25 changes: 25 additions & 0 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,31 @@ Example Commit Message

Closes #1234567

Releasing a new version
-----------------------

#. Prepare the release pull request

* In ``requests_toolbelt/__init__.py``, bump the version number

* In ``HISTORY.rst``, include noteworthy changes under the relevant sections

* Open a pull request with the above changes, and make any changes required
to get it approved

#. "Squash and merge" the pull request in GitHub, which will give you a release
commit

#. Tag the release with that commit:

* Create the tag: ``git tag -s -a $VERSION -m "Release v$VERSION"``

* Push it the main repository (not you fork!): ``git push <remote> --tags``

#. Upload it on PyPI with ``tox -e release``

#. [Optional] Announce it where relevant (social media, GitHub issues...)

Footnotes
---------

Expand Down
4 changes: 2 additions & 2 deletions docs/threading.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ Here's an example:
]
for url in urls:
queue.put({'method': 'GET', 'url': url})
jobs.put({'method': 'GET', 'url': url})
p = pool.Pool(job_queue=q)
p = pool.Pool(job_queue=jobs)
p.join_all()
for response in p.responses():
Expand Down
2 changes: 1 addition & 1 deletion requests_toolbelt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
__authors__ = 'Ian Cordasco, Cory Benfield'
__license__ = 'Apache v2.0'
__copyright__ = 'Copyright 2014 Ian Cordasco, Cory Benfield'
__version__ = '0.9.1'
__version__ = '1.0.0'
__version_info__ = tuple(int(i) for i in __version__.split('.'))

__all__ = [
Expand Down
22 changes: 0 additions & 22 deletions requests_toolbelt/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,6 @@
except ImportError:
from urllib3.util import timeout

if requests.__build__ < 0x021000:
gaecontrib = None
else:
try:
from requests.packages.urllib3.contrib import appengine as gaecontrib
except ImportError:
from urllib3.contrib import appengine as gaecontrib

if requests.__build__ < 0x021200:
PyOpenSSLContext = None
else:
try:
from requests.packages.urllib3.contrib.pyopenssl \
import PyOpenSSLContext
except ImportError:
try:
from urllib3.contrib.pyopenssl import PyOpenSSLContext
except ImportError:
PyOpenSSLContext = None

PY3 = sys.version_info > (3, 0)

if PY3:
Expand Down Expand Up @@ -318,7 +298,5 @@ def from_httplib(cls, message): # Python 2
'HTTPHeaderDict',
'queue',
'urlencode',
'gaecontrib',
'urljoin',
'PyOpenSSLContext',
)
Loading

0 comments on commit d9efaca

Please sign in to comment.