thepeer


Namethepeer JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/gray-adeyi/thepeer
SummaryA 3rd party developer friendly client package for thepeer
upload_time2023-09-26 12:51:23
maintainerGbenga Adeyi
docs_urlNone
authorGbenga Adeyi
requires_python>=3.9,<4.0
licenseMIT
keywords thepeer api wrapper
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # thepeer
A 3rd party developer friendly python client package for [thepeer](https://thepeer.co/)

## installation
`pip install thepeer`

## usage
Future versions of this package will provide a much better documentation. This
version was published to claim the package namespace. however, the package is quite
functional as is. First of, you want to import the client
```python

from thepeer import ThePeerClient, ChargeEvent, PaymentChannel
client = ThePeerClient(secret_key="<secret_key>") # you can omit the secret key param if
# the environmental variable THEPEER_SECRET_KEY is set.
response = client.users.all() # Fetch all indexed users.
print(response)

response = client.transactions.get("<transaction_id>") # Fetch a transaction.
print(response)

response = client.links.get_user_links("<user_reference>") # Fetch all linked accounts of a user.
print(response)

response = client.authorize_charge("<charge_reference>", 
                                   event=ChargeEvent.INSUFFICIENT_FUNDS) # Process a charge authorization request.
print(response)

response = client.generate_checkout(amount=10000, email="johndoe@example.com") # Generate a checkout.
print(response)

response = client.get_businesses(
    channel=PaymentChannel.DIRECT_CHARGE) # Fetch businesses based on the API they integrated.
print(response)
```
`ThePeerClient` has three attributes bound to it `users` for user related operations,
`transactions` for transaction related operations and `links` for link related operations.
It also provides additional methods `authorize_charge`, `generate_checkout` and `get_businessses`.
All methods on the client returns a `Response` with is a dataclass containing the `status_code`
and `data` returned from thepeer. This package also provides an async client which mirrors this
client and can come in handy in async context
```python
# note the following code should be tested in an async context to work
# e.g. `python -m asynio`
from thepeer import AsyncThePeerClient

client = AsyncThePeerClient(secret_key="<secret_key>") # you can omit the secret key param if
# the environmental variable THEPEER_SECRET_KEY is set.
response = await client.users.all() # Notice that the `all` method is identical to that
# on the `ThePeerClient` except that we had to await it here.
print(response)
```
All methods are type annotated and also provide docstrings for a smooth developer experience.
I hope you find this package useful.

## source code

- [https://github.com/gray-adeyi/thepeer](https://github.com/gray-adeyi/thepeer)

## license

- MIT
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/gray-adeyi/thepeer",
    "name": "thepeer",
    "maintainer": "Gbenga Adeyi",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "adeyigbenga005@gmail.com",
    "keywords": "thepeer,api wrapper",
    "author": "Gbenga Adeyi",
    "author_email": "adeyigbenga005@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/46/98/e4b73b801b86e165c14fd9cec69ca1192a9280096610864b9ec18bd053b7/thepeer-0.1.0.tar.gz",
    "platform": null,
    "description": "# thepeer\nA 3rd party developer friendly python client package for [thepeer](https://thepeer.co/)\n\n## installation\n`pip install thepeer`\n\n## usage\nFuture versions of this package will provide a much better documentation. This\nversion was published to claim the package namespace. however, the package is quite\nfunctional as is. First of, you want to import the client\n```python\n\nfrom thepeer import ThePeerClient, ChargeEvent, PaymentChannel\nclient = ThePeerClient(secret_key=\"<secret_key>\") # you can omit the secret key param if\n# the environmental variable THEPEER_SECRET_KEY is set.\nresponse = client.users.all() # Fetch all indexed users.\nprint(response)\n\nresponse = client.transactions.get(\"<transaction_id>\") # Fetch a transaction.\nprint(response)\n\nresponse = client.links.get_user_links(\"<user_reference>\") # Fetch all linked accounts of a user.\nprint(response)\n\nresponse = client.authorize_charge(\"<charge_reference>\", \n                                   event=ChargeEvent.INSUFFICIENT_FUNDS) # Process a charge authorization request.\nprint(response)\n\nresponse = client.generate_checkout(amount=10000, email=\"johndoe@example.com\") # Generate a checkout.\nprint(response)\n\nresponse = client.get_businesses(\n    channel=PaymentChannel.DIRECT_CHARGE) # Fetch businesses based on the API they integrated.\nprint(response)\n```\n`ThePeerClient` has three attributes bound to it `users` for user related operations,\n`transactions` for transaction related operations and `links` for link related operations.\nIt also provides additional methods `authorize_charge`, `generate_checkout` and `get_businessses`.\nAll methods on the client returns a `Response` with is a dataclass containing the `status_code`\nand `data` returned from thepeer. This package also provides an async client which mirrors this\nclient and can come in handy in async context\n```python\n# note the following code should be tested in an async context to work\n# e.g. `python -m asynio`\nfrom thepeer import AsyncThePeerClient\n\nclient = AsyncThePeerClient(secret_key=\"<secret_key>\") # you can omit the secret key param if\n# the environmental variable THEPEER_SECRET_KEY is set.\nresponse = await client.users.all() # Notice that the `all` method is identical to that\n# on the `ThePeerClient` except that we had to await it here.\nprint(response)\n```\nAll methods are type annotated and also provide docstrings for a smooth developer experience.\nI hope you find this package useful.\n\n## source code\n\n- [https://github.com/gray-adeyi/thepeer](https://github.com/gray-adeyi/thepeer)\n\n## license\n\n- MIT",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A 3rd party developer friendly client package for thepeer",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/gray-adeyi/thepeer",
        "Repository": "https://github.com/gray-adeyi/thepeer"
    },
    "split_keywords": [
        "thepeer",
        "api wrapper"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "848a3b0dc3b99655b99dedbf306ffd1795a8ca6e493073ee08bf778915a9c20a",
                "md5": "60ca5e4d1c4ff0fcb6e612a7347e2e66",
                "sha256": "a8d949f2097e9049eea97feb3240d5c471d5a9c485e0a1a1b1aeebdd2d82d334"
            },
            "downloads": -1,
            "filename": "thepeer-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "60ca5e4d1c4ff0fcb6e612a7347e2e66",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 9787,
            "upload_time": "2023-09-26T12:51:20",
            "upload_time_iso_8601": "2023-09-26T12:51:20.425607Z",
            "url": "https://files.pythonhosted.org/packages/84/8a/3b0dc3b99655b99dedbf306ffd1795a8ca6e493073ee08bf778915a9c20a/thepeer-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4698e4b73b801b86e165c14fd9cec69ca1192a9280096610864b9ec18bd053b7",
                "md5": "b3fa15287a7b0fcd9b8a4bd57d03a174",
                "sha256": "2da251d8a81ae1021514e562cb12189e465948cdb038851cd36a96e421b40043"
            },
            "downloads": -1,
            "filename": "thepeer-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b3fa15287a7b0fcd9b8a4bd57d03a174",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 7409,
            "upload_time": "2023-09-26T12:51:23",
            "upload_time_iso_8601": "2023-09-26T12:51:23.294268Z",
            "url": "https://files.pythonhosted.org/packages/46/98/e4b73b801b86e165c14fd9cec69ca1192a9280096610864b9ec18bd053b7/thepeer-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-26 12:51:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "gray-adeyi",
    "github_project": "thepeer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "thepeer"
}
        
Elapsed time: 4.15045s