Skip to content

Commit

Permalink
Version 0.4.0
Browse files Browse the repository at this point in the history
Critical fix to unicode handling in collect method.
Refactoring of setup.py
Added version file.
Updated requirements.
Added Python 3.6 to Travis CI.
  • Loading branch information
hbldh committed Feb 16, 2017
1 parent 0d222dc commit f074f2d
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 96 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ sudo: false
python:
- 2.6
- 2.7
- 3.3
- 3.4
- 3.5
- "3.5-dev"
- 3.6
- "nightly"
- pypy
matrix:
allow_failures:
- python: 2.6
- python: "3.5-dev"
- python: "nightly"
- python: pypy
branches:
Expand Down
6 changes: 4 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ PyBankID
:alt: Documentation Status
.. image:: http://img.shields.io/pypi/v/pybankid.svg
:target: https://pypi.python.org/pypi/pybankid/
.. image:: http://img.shields.io/pypi/dm/pybankid.svg
:target: https://pypi.python.org/pypi/pybankid/
.. image:: http://img.shields.io/pypi/l/pybankid.svg
:target: https://pypi.python.org/pypi/pybankid/
.. image:: https://coveralls.io/repos/github/hbldh/pybankid/badge.svg?branch=master
Expand Down Expand Up @@ -36,8 +38,8 @@ PyBankID can be installed though pip:
pip install pybankid
To remedy the ``InsecurePlatformWarning`` problem detailed below
(`Python 2, urllib3 and certificate verification`_), you can install
The remedy the ``InsecurePlatformWarning`` problem detailed below (
`Python 2, urllib3 and certificate verification`_), you can install
``pybankid`` with the ``security`` extras:

.. code-block:: bash
Expand Down
69 changes: 4 additions & 65 deletions bankid/__init__.py
Original file line number Diff line number Diff line change
@@ -1,69 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Release data for the PyBankID project."""

# A quick and dirty fix for installation and importing.
try:
from .client import BankIDClient
import bankid.exceptions as exceptions
from .certutils import create_bankid_test_server_cert_and_key
from .client import BankIDClient
import bankid.exceptions as exceptions
from .certutils import create_bankid_test_server_cert_and_key

__all__ = ['BankIDClient', 'exceptions', 'create_bankid_test_server_cert_and_key', 'version']
except ImportError:
pass

# Name of the package for release purposes. This is the name which labels
# the tarballs and RPMs made by distutils, so it's best to lowercase it.
_name = 'pybankid'

# Version information. An empty _version_extra corresponds to a full
# release. 'dev' as a _version_extra string means this is a development
# version.
_version_major = 0
_version_minor = 3
_version_patch = 6
# _version_extra = 'dev1'
# _version_extra = 'a1'
_version_extra = '' # Uncomment this for full releases

# Construct full version string from these.
_ver = [_version_major, _version_minor, _version_patch]

__version__ = '.'.join(map(str, _ver))
if _version_extra:
__version__ = __version__ + '.' + str(_version_extra)

version = __version__ # backwards compatibility name
version_info = (_version_major, _version_minor, _version_patch, _version_extra)

__description__ = "BankID client for Python"

__license__ = 'MIT'

__authors__ = {
'hbldh': ('Henrik Blidh', 'henrik.blidh@nedomkull.com'),
}
__author__ = 'Henrik Blidh'
__author_email__ = 'henrik.blidh@nedomkull.com'
__url__ = 'https://github.com/hbldh/pybankid/'
__download_url__ = 'https://github.com/hbldh/pybankid/tarball/' + '.'.join(map(str, _ver))

__platforms__ = ['Linux', 'Mac OSX', 'Windows XP/Vista/7/8']
__keywords__ = ['BankID', 'SOAP']
__classifiers__ = [
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX :: Linux',
'Operating System :: Microsoft :: Windows',
'Operating System :: MacOS :: MacOS X',
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Topic :: Security',
'Topic :: Utilities',
]
__all__ = ['BankIDClient', 'exceptions', 'create_bankid_test_server_cert_and_key', 'version']
13 changes: 11 additions & 2 deletions bankid/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ def _dictify(self, doc):
out = {}
try:
for k in doc:
k = six.text_type(k)
k = _to_unicode(k)
if isinstance(doc[k], Text):
out[k] = six.text_type(doc[k], encoding='utf-8')
out[k] = _to_unicode(doc[k])
elif isinstance(doc[k], datetime.datetime):
out[k] = doc[k]
else:
Expand All @@ -176,6 +176,15 @@ def _dictify(self, doc):
return out


def _to_unicode(s):
if isinstance(s, Text):
return six.text_type(s.unescape())
elif isinstance(s, six.text_type):
return s
elif isinstance(s, six.binary_type):
return s.decode('utf-8')


class RequestsTransport(HttpAuthenticated):
"""A Requests-based transport for suds, enabling the use of https and
certificates when communicating with the SOAP service.
Expand Down
16 changes: 16 additions & 0 deletions bankid/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
version.py
-----------
:copyright: 2016-11-28 by hbldh <henrik.blidh@nedomkull.com>
"""

from __future__ import division
from __future__ import print_function
from __future__ import absolute_import

__version__ = '0.4.0'
version = __version__ # backwards compatibility name
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
requests>=2.7.0
requests>=2.13.0
suds-jurko>=0.6
six>=1.9.0
six>=1.10.0
59 changes: 37 additions & 22 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,51 @@
from __future__ import print_function
from __future__ import absolute_import

import os
import re
from codecs import open
from setuptools import setup, find_packages
import bankid

# Get the long description from the README file
try:
with open(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'README.rst')) as f:
long_description = f.read()
except:
long_description = __doc__

with open('bankid/version.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)


def read(f):
return open(f, encoding='utf-8').read()


setup(
name='pybankid',
version=bankid.__version__,
author=bankid.__author__,
author_email=bankid.__author_email__,
description=bankid.__description__,
long_description=long_description,
license=bankid.__license__,
url=bankid.__url__,
classifiers=bankid.__classifiers__,
platforms=bankid.__platforms__,
version=version,
author='Henrik Blidh',
author_email='henrik.blidh@nedomkull.com',
description="BankID client for Python",
long_description=read('README.rst'),
license='MIT',
url='https://github.com/hbldh/pybankid/',
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX :: Linux',
'Operating System :: Microsoft :: Windows',
'Operating System :: MacOS :: MacOS X',
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Topic :: Security',
'Topic :: Utilities',
],
platforms=['Linux', 'Mac OSX', 'Windows XP/Vista/7/8'],
packages=find_packages(exclude=('tests', )),
package_data={'': ['*.pem']},
install_requires=[
'requests>=2.7.0',
'suds-jurko>=0.6',
'six>=1.9.0'
],
install_requires=read('requirements.txt').strip().splitlines(),
dependency_links=[],
ext_modules=[],
extras_require={
Expand Down

0 comments on commit f074f2d

Please sign in to comment.