Skip to main content

Python SDK for WePay API (third party).

Project description

Python WePay SDK (third party)
==============================

.. image:: https://travis-ci.org/lehins/python-wepay.svg?branch=master
:target: https://travis-ci.org/lehins/python-wepay
:alt: Travis-CI

.. image:: https://coveralls.io/repos/lehins/python-wepay/badge.png?branch=master
:target: https://coveralls.io/r/lehins/python-wepay?branch=master
:alt: Tests Coverage

.. image:: https://pypip.in/d/python-wepay/badge.png
:target: https://crate.io/packages/python-wepay/
:alt: Number of PyPI downloads


Features
--------

* Make API calls in a very natural pythonic way, ex:

.. code-block:: python

>>> api = WePay(production=False, access_token='STAGE_243...')
>>> response = api.credit_card.create(client_id, cc_number, ..., original_ip='127...')
>>> api.credit_card.authorize(client_id, client_secret, response['credit_card_id'])

* Validation of all required and optional parameters to each one of the calls.
* Very easy construction of batch calls, simply by passing ``batch_mode=True`` to
a call, ex:

.. code-block:: python

>>> calls = []
>>> calls.append(api.credit_card.authorize(
... client_id, client_secret, response['credit_card_id'],
... batch_mode=True, batch_reference_id='ref_id_1234'))
>>> # append more calls ...
>>> response = api.batch.create(client_id, client_secret, calls)


About
-----

This package started as a part of `Django WePay Application
<https://github.com/lehins/django-wepay>`_, but I soon realized it could be
useful to other developers in Python community that do not use `Django
<https://djangoproject.com>`_. Originally it meant to be an extension of an
official `Python WePay SDK <https://github.com/wepay/Python-SDK>`_, but instead
it became a replacement with full compatibilty with official WePay version.
This package is also listed as a `third party Python SDK on WePay
<https://www.wepay.com/developer/resources/sdks>`_.

Status
------

Production.

Requirements
------------

* Python >= 2.7 or >= 3.2
* Registered Application with WePay `production <https://wepay.com>`_ site or
it's `development <https://stage.wepay>`_ clone.
* `six <https://pypi.python.org/pypi/six>`_.
* `requests <http://docs.python-requests.org/en/latest/>`_ (optional):
* `mock <https://pypi.python.org/pypi/mock>`_ (optional, for tests only)

Installation
------------
::

pip install python-wepay


Documentation
-------------

http://python-wepay.readthedocs.org/en/latest/index.html

License
-------

MIT licensed. See the bundled `LICENSE <https://github.com/lehins/python-wepay/blob/master/LICENSE>`_ file for more details.


Changelog
=========

1.3.5
-----

* Fixed and improved error handling, new exceptions: :exc:`WePayClientError<wepay.exceptions.WePayClientError>` and :exc:`WePayServerError<wepay.exceptions.WePayServerError>`

1.3.4
-----

* Connection `timeout` can be specified on per call basis.

1.3.0
-----

* Python 3 compatible
* Calls are made using `requests <http://docs.python-requests.org/en/latest/>`_
library by default (if installed), falls back to `urllib
<https://docs.python.org/3/library/urllib.html#module-urllib>`_ if `requests`
are not installed or if ``WePay`` is initialized with
``use_requests=False``.
* ``WePayConnectionError`` is raised
in case there is a problem connecting to WePay server, ex. timeout.
* Addition of a full test suit.
* Minor:

* 'original_ip' and 'original_device' params are now optional in
`/credit_card/create`.
* ``silent`` mode is more flexible.
* Moved ``SubscriptionPlan`` and ``SubscriptionCharge`` to their own modules.
* Moved ``WePayWarning`` over to ``wepay.exceptions`` module.

1.2.0
-----

* New API version 2014-01-08 changes are reflected in this SDK version:

* implemented `/user/register` and `user/resend_confirmation` calls.
* added `/account/get_update_uri` and `/account/get_reserve_details`
* depricated `/account/add_bank`, `/account/balance`, `/account/get_tax`
and `/account/set_tax` calls.

* restructured SDK in such a way that all API objects are separate classes, so
as an example, if we have a WePay instance ``api = WePay()`` and we want to
make a `/account/find` call, it will look like this ``api.account.find()``
instead of ``api.account_find()`` (notice **.** instead of **_**), although in
this version both are equivalent, latter one is depricated and will be removed
in version 1.3. Despite these changes lookup calls will be the same, ex.
``api.account(12345)``.

* Added flexibility to use different API version per call basis. So it is now
possible to make a depricated call like this: ``api.account.balance(1234,
api_version='2011-01-15')``

* added ``batch_reference_id`` keyword argument to each call that accepts
``batch_mode``


1.1.2
-----

* Added required arguments to `/credit_card/create` call:

* original_ip
* original_device

1.1.0
-----

* Added subscription calls:

* `/subscription_plan`
* `/subscription`
* `/subscription_charge`

* Few bug and spelling fixes.

1.0.0
-----

* Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-wepay-1.3.5.tar.gz (42.4 kB view details)

Uploaded Source

Built Distribution

python_wepay-1.3.5-py2-none-any.whl (37.9 kB view details)

Uploaded Python 2

File details

Details for the file python-wepay-1.3.5.tar.gz.

File metadata

File hashes

Hashes for python-wepay-1.3.5.tar.gz
Algorithm Hash digest
SHA256 9bcd9bd7c8c0f6af3468f6ad1bacd043f963e72c8d829e9bb500ee89d1049b39
MD5 0671a4133a6cd72d84db2802b0b3a709
BLAKE2b-256 8407488b2d1cfcffebbe9ced0299ad902ffae4e2df367b3337504d9fae36d8ee

See more details on using hashes here.

File details

Details for the file python_wepay-1.3.5-py2-none-any.whl.

File metadata

File hashes

Hashes for python_wepay-1.3.5-py2-none-any.whl
Algorithm Hash digest
SHA256 030c8e7adfc4d3402966531967d27a2e1fdb573083043491c19f9d82c4f7697f
MD5 ce64b537e0843fafcd357dbc27c41411
BLAKE2b-256 6ae6b10d88841f271ce9c3262b3beb8e0a2f9fc5e2d18cbe510852b931121fc5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page