Skip to content

Commit

Permalink
Merge pull request #2 from strollby/patch-sequence-visitor
Browse files Browse the repository at this point in the history
Patch sequence visitor
  • Loading branch information
adarshdigievo authored Apr 20, 2023
2 parents 121262e + b50db39 commit 51dd3cc
Show file tree
Hide file tree
Showing 49 changed files with 242 additions and 136 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 4.1.0
current_version = 4.2.1
commit = true
tag = true
tag_name = {new_version}
Expand Down
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: [mvantellingen]
13 changes: 9 additions & 4 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
Expand All @@ -20,10 +20,15 @@ jobs:
test:
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
max-parallel: 4
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.6", "3.7", "3.8", "3.9"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
# TODO: Remove Windows exclusion when binary wheel available for lxml
exclude:
- { platform: windows-latest, python-version: "3.11" }


steps:
- name: Install system dependencies
Expand All @@ -37,7 +42,7 @@ jobs:
brew install libxmlsec1 libxslt pkgconfig
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down Expand Up @@ -65,7 +70,7 @@ jobs:
name: coverage-data
path: .
- name: Set up Python 3.7
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
env/
*.egg-info
*.pyc
__pycache__
Expand Down
17 changes: 17 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
4.2.1 (2022-11-10)
-------------------
- Fix error regarding closing session in async transport (#1347)

4.2.0 (2022-11-03)
-------------------
- Drop support for Python 3.6
- Allow embedding CDATA elements in simple types (#1339)
- Allow to pass in a pre parsed Document (#1330)
- Fix httpx DeprecationWarning for post data (#1326)
- Add BinaryMemorySignature (#1300)
- Fix IndexError when empty body response (#1287)
- Add support for context manager on Client (#1166)
- Allow Ws Addressing plugin to use a different URL (#1328)
- Accept strings for xsd base64Binary (#1072)


4.1.0 (2021-08-15)
------------------
- Remove last dependency on `six` (#1250)
Expand Down
16 changes: 11 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
Zeep: Python SOAP client
========================

A fast and modern Python SOAP client
A Python SOAP client

Highlights:
* Compatible with Python 3.6, 3.7, 3.8, 3.9 and PyPy
* Build on top of lxml and requests
* Compatible with Python 3.7, 3.8, 3.9, 3.10, 3.11 and PyPy3
* Build on top of lxml, requests and httpx
* Support for Soap 1.1, Soap 1.2 and HTTP bindings
* Support for WS-Addressing headers
* Support for WSSE (UserNameToken / x.509 signing)
Expand All @@ -23,6 +23,10 @@ http://docs.python-zeep.org/
Status
------


**I consider this library to be stable. Since no new developments happen around the SOAP specification it won't be updated that much. Good PR's which fix bugs are always welcome however.**


.. image:: https://readthedocs.org/projects/python-zeep/badge/?version=latest
:target: https://readthedocs.org/projects/python-zeep/

Expand All @@ -44,9 +48,11 @@ Installation
pip install zeep
Note that the latest version to support Python 2.7, 3.3, 3.4 and 3.5 is Zeep 3.4, install via `pip install zeep==3.4.0`
Note that the latest version to support Python 2.7, 3.3, 3.4 and 3.5 is Zeep
3.4, install via `pip install zeep==3.4.0`

Zeep uses the lxml library for parsing xml. See https://lxml.de/installation.html for the installation requirements.
Zeep uses the lxml library for parsing xml. See
https://lxml.de/installation.html for the installation requirements.

Usage
-----
Expand Down
2 changes: 1 addition & 1 deletion docs/_templates/sidebar-intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<img class="logo" src="{{ pathto('_static/zeep-logo.png', 1) }}">
</a>

<p>Zeep is a modern SOAP client for Python</p>
<p>Zeep is a SOAP client for Python</p>
<p>
<iframe src="http://ghbtns.com/github-btn.html?user=mvantellingen&repo=python-zeep&type=watch&count=true&size=large"
allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe>
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
# built documents.
#
# The short X.Y version.
version = '4.1.0'
version = '4.2.1'
release = version

# The language for content autogenerated by Sphinx. Refer to documentation
Expand Down
10 changes: 5 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
Zeep: Python SOAP client
========================

A fast and modern Python SOAP client
A Python SOAP client

Highlights:
* Compatible with Python 3.6, 3.7, 3.8 and PyPy
* Compatible with Python 3.7, 3.8, 3.9, 3.10, 3.11 and PyPy
* Build on top of lxml and requests
* Support for Soap 1.1, Soap 1.2 and HTTP bindings
* Support for WS-Addressing headers
Expand Down Expand Up @@ -70,8 +70,8 @@ If you have installed pip then run::
pip install zeep


Note that the latest version to support Python 2.7, 3.3, 3.4 and 3.5 is Zeep 3.4,
install via `pip install zeep==3.4.0`
Note that the latest version to support Python 2.7, 3.3, 3.4 and 3.5 is Zeep 3.4,
install via `pip install zeep==2.4.0`

This assumes that there are wheel files available for the latest lxml release.
If that is not the case (https://pypi.python.org/pypi/lxml/) then first
Expand Down Expand Up @@ -106,7 +106,7 @@ See ``python -mzeep --help`` for more information about this command.

.. note:: Zeep follows `semver`_ for versioning, however bugs can always occur.
So as always pin the version of zeep you tested with
(e.g. ``zeep==4.1.0``').
(e.g. ``zeep==4.2.1``').


.. _semver: http://semver.org/
Expand Down
2 changes: 1 addition & 1 deletion examples/trafficvance_apikey.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
API_KEY_TEST = 'YOUR_OWN_API_KEY'
WSDL_TEST = 'https://apitest.trafficvance.com/?v3=system.wsdl'

client = Client(WSDL)
client = Client(WSDL_TEST)
header = xsd.Element(
'{WSDL_TEST}AuthenticateRequest',
xsd.ComplexType([
Expand Down
5 changes: 3 additions & 2 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[mypy]
files = src/, benchmark/, examples/, tests/
ignore_missing_imports = True
python_version = 3.6
implicit_reexport = False
python_version = 3.7
warn_unused_configs = True
mypy_path = src
warn_unreachable = True
follow_imports = True
follow_imports_for_stubs = True
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
[wheel]
universal = 1

[flake8]
max-line-length = 99
20 changes: 12 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"sphinx>=1.4.0",
]

async_require = ["httpx"]
async_require = ["httpx>=0.15.0"]

xmlsec_require = [
"xmlsec>=0.6.1",
Expand All @@ -27,12 +27,11 @@
tests_require = [
"coverage[toml]==5.2.1",
"freezegun==0.3.15",
"mock==2.0.0",
"pretend==1.0.9",
"pytest-cov==2.8.1",
"pytest-httpx",
"pytest-asyncio",
"pytest==6.0.1",
"pytest==6.2.5",
"requests_mock>=0.7.0",
# Linting
"isort==5.3.2",
Expand All @@ -50,13 +49,16 @@

setup(
name="zeep",
version="4.1.0",
description="A modern/fast Python SOAP client based on lxml / requests",
version="4.2.1",
description="A Python SOAP client",
long_description=long_description,
author="Michael van Tellingen",
author_email="[email protected]",
url="http://docs.python-zeep.org",
python_requires=">=3.6",
url="https://docs.python-zeep.org",
project_urls={
"Source": "https://github.com/mvantellingen/python-zeep",
},
python_requires=">=3.7",
install_requires=install_requires,
tests_require=tests_require,
extras_require={
Expand All @@ -74,10 +76,12 @@
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],
Expand Down
21 changes: 15 additions & 6 deletions src/zeep/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
from zeep.client import AsyncClient, CachingClient, Client # noqa
from zeep.plugins import Plugin # noqa
from zeep.settings import Settings # noqa
from zeep.transports import Transport # noqa
from zeep.xsd.valueobjects import AnyObject # noqa
from zeep.client import AsyncClient, CachingClient, Client
from zeep.plugins import Plugin
from zeep.settings import Settings
from zeep.transports import Transport
from zeep.xsd.valueobjects import AnyObject

__version__ = "4.1.0"
__version__ = "4.2.1"
__all__ = [
"AsyncClient",
"CachingClient",
"Client",
"Plugin",
"Settings",
"Transport",
"AnyObject",
]
2 changes: 1 addition & 1 deletion src/zeep/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def _version_string(self):
assert (
getattr(self, "_version", None) is not None
), "A version must be provided in order to use the VersionedCacheBase backend."
prefix = u"$ZEEP:%s$" % self._version
prefix = "$ZEEP:%s$" % self._version
return bytes(prefix.encode("ascii"))


Expand Down
16 changes: 13 additions & 3 deletions src/zeep/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __getitem__(self, key):
class Client:
"""The zeep Client.
:param wsdl:
:param wsdl: Url/local WSDL location or preparsed WSDL Document
:param wsse:
:param transport: Custom transport class.
:param service_name: The service name for the service binding. Defaults to
Expand All @@ -51,7 +51,7 @@ class Client:
"""

_default_transport = Transport
_default_transport: typing.Union[Transport, AsyncTransport] = Transport

def __init__(
self,
Expand All @@ -70,7 +70,10 @@ def __init__(
self.transport = (
transport if transport is not None else self._default_transport()
)
self.wsdl = Document(wsdl, self.transport, settings=self.settings)
if isinstance(wsdl, Document):
self.wsdl = wsdl
else:
self.wsdl = Document(wsdl, self.transport, settings=self.settings)
self.wsse = wsse
self.plugins = plugins if plugins is not None else []

Expand Down Expand Up @@ -211,6 +214,13 @@ def _get_service(self, name: typing.Optional[str]) -> str:
service = next(iter(self.wsdl.services.values()), None)
return service

def __enter__(self):
return self

def __exit__(self, exc_type=None, exc_value=None, traceback=None):
if hasattr(self.transport, "close"):
self.transport.close()


class AsyncClient(Client):
_default_transport = AsyncTransport
Expand Down
4 changes: 3 additions & 1 deletion src/zeep/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ def parse_xml(content: str, transport, base_url=None, settings=None):
)


def load_external(url: typing.IO, transport, base_url=None, settings=None):
def load_external(
url: typing.Union[typing.IO, str], transport, base_url=None, settings=None
):
"""Load an external XML document.
:param url:
Expand Down
8 changes: 4 additions & 4 deletions src/zeep/transports.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self, cache=None, timeout=300, operation_timeout=None, session=None
self.operation_timeout = operation_timeout
self.logger = logging.getLogger(__name__)

self.__close_session = not session
self._close_session = not session
self.session = session or requests.Session()
self.session.mount("file://", FileAdapter())
self.session.headers["User-Agent"] = "Zeep/%s (www.python-zeep.org)" % (
Expand Down Expand Up @@ -156,7 +156,7 @@ def settings(self, timeout=None):
self.operation_timeout = old_timeout

def __del__(self):
if self.__close_session:
if self._close_session:
self.session.close()


Expand All @@ -175,13 +175,13 @@ def __init__(
cache=None,
timeout=300,
operation_timeout=None,
session=None,
verify_ssl=True,
proxy=None,
):
if httpx is None:
raise RuntimeError("The AsyncTransport is based on the httpx module")

self._close_session = False
self.cache = cache
self.wsdl_client = wsdl_client or httpx.Client(
verify=verify_ssl,
Expand Down Expand Up @@ -219,7 +219,7 @@ async def post(self, address, message, headers):
self.logger.debug("HTTP Post to %s:\n%s", address, message)
response = await self.client.post(
address,
data=message,
content=message,
headers=headers,
)
self.logger.debug(
Expand Down
Loading

0 comments on commit 51dd3cc

Please sign in to comment.