xerosdk


Namexerosdk JSON
Version 0.14.2 PyPI version JSON
download
home_pagehttps://github.com/fylein/xero-sdk-py
SummaryPython SDK to access Xero APIs
upload_time2024-10-11 09:06:01
maintainerNone
docs_urlNone
authorAshwin T
requires_pythonNone
licenseMIT
keywords xero api python sdk
VCS
bugtrack_url
requirements requests
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # xero-sdk-py
Python SDK to access Xero APIs

## Requirements

1. [Python 3+](https://www.python.org/downloads/)
2. [Requests](https://pypi.org/project/requests/) library

## Installation

Install Xero SDK using [pip](https://pypi.org) as follows:

```
pip install xerosdk
```

## Usage

This SDK requires OAuth2 authentication credentials such as 
**client ID**, **client secret** and **refresh token**.

1. Create a connection using the XeroSDK class.

```python
from xerosdk import XeroSDK 

connection = XeroSDK(
    base_url='<XERO_BASE_URL>',
    client_id='<YOUR CLIENT ID>',
    client_secret='<YOUR CLIENT SECRET>',
    refresh_token='<YOUR REFRESH TOKEN>'
)

# tenant_id is required to make a call to any API
tenant_id = connection.tenants.get_all()[0]['tenantId']
connection.set_tenant_id(tenant_id)
```

2. Access any of the API classes

```python
"""
USAGE: <XeroSDK INSTANCE>.<API_NAME>.<API_METHOD>(<PARAMETERS>)
"""

# Get a list of all Invoices
response = connection.invoices.get_all()

# Get a list of all Invoices using generator
for response in invoices.list_all_generator():
   print(response)

# Get an Invoice by id
response = connection.invoices.get_by_id(<invoice_id>)
```

**NOTE**: Only Tenants, Invoices, Accounts, Contacts, Items and TrackingCategories 
API classes are defined in this SDK.

## Integration Tests

1. Install [pytest](https://pypi.org/project/pytest/) package using pip as follows:

```
pip install pytest
```

2. Create a 'test_credentials.json' file at project root directory and enter Xero OAuth2 authentication credentials of 
your Xero app.

```json
{
  "base_url": "<xero_base_url>",
  "client_id": "<client_id>",
  "client_secret": "<client_secret>",
  "refresh_token": "<refresh_token>"
}
```

3. Run integration tests as follows:

```
python -m pytest tests/integration
```
   

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/fylein/xero-sdk-py",
    "name": "xerosdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "xero, api, python, sdk",
    "author": "Ashwin T",
    "author_email": "ashwin.t@fyle.in",
    "download_url": "https://files.pythonhosted.org/packages/fa/95/3e62606b5364aa5179b4978653ba8c879626996ad553016bb88033061805/xerosdk-0.14.2.tar.gz",
    "platform": null,
    "description": "# xero-sdk-py\nPython SDK to access Xero APIs\n\n## Requirements\n\n1. [Python 3+](https://www.python.org/downloads/)\n2. [Requests](https://pypi.org/project/requests/) library\n\n## Installation\n\nInstall Xero SDK using [pip](https://pypi.org) as follows:\n\n```\npip install xerosdk\n```\n\n## Usage\n\nThis SDK requires OAuth2 authentication credentials such as \n**client ID**, **client secret** and **refresh token**.\n\n1. Create a connection using the XeroSDK class.\n\n```python\nfrom xerosdk import XeroSDK \n\nconnection = XeroSDK(\n    base_url='<XERO_BASE_URL>',\n    client_id='<YOUR CLIENT ID>',\n    client_secret='<YOUR CLIENT SECRET>',\n    refresh_token='<YOUR REFRESH TOKEN>'\n)\n\n# tenant_id is required to make a call to any API\ntenant_id = connection.tenants.get_all()[0]['tenantId']\nconnection.set_tenant_id(tenant_id)\n```\n\n2. Access any of the API classes\n\n```python\n\"\"\"\nUSAGE: <XeroSDK INSTANCE>.<API_NAME>.<API_METHOD>(<PARAMETERS>)\n\"\"\"\n\n# Get a list of all Invoices\nresponse = connection.invoices.get_all()\n\n# Get a list of all Invoices using generator\nfor response in invoices.list_all_generator():\n   print(response)\n\n# Get an Invoice by id\nresponse = connection.invoices.get_by_id(<invoice_id>)\n```\n\n**NOTE**: Only Tenants, Invoices, Accounts, Contacts, Items and TrackingCategories \nAPI classes are defined in this SDK.\n\n## Integration Tests\n\n1. Install [pytest](https://pypi.org/project/pytest/) package using pip as follows:\n\n```\npip install pytest\n```\n\n2. Create a 'test_credentials.json' file at project root directory and enter Xero OAuth2 authentication credentials of \nyour Xero app.\n\n```json\n{\n  \"base_url\": \"<xero_base_url>\",\n  \"client_id\": \"<client_id>\",\n  \"client_secret\": \"<client_secret>\",\n  \"refresh_token\": \"<refresh_token>\"\n}\n```\n\n3. Run integration tests as follows:\n\n```\npython -m pytest tests/integration\n```\n   \n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python SDK to access Xero APIs",
    "version": "0.14.2",
    "project_urls": {
        "Homepage": "https://github.com/fylein/xero-sdk-py"
    },
    "split_keywords": [
        "xero",
        " api",
        " python",
        " sdk"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "86f2b518b738626dd0110085f2d796a57db24681db9d8908d002b91919ba50e4",
                "md5": "ed18dcf70aedef337d00501e75665d4b",
                "sha256": "9c7006e3058fe0924ca4190d7c88ada9b94f1c5559bad06e0886bc22bc7eb15a"
            },
            "downloads": -1,
            "filename": "xerosdk-0.14.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ed18dcf70aedef337d00501e75665d4b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 16948,
            "upload_time": "2024-10-11T09:05:59",
            "upload_time_iso_8601": "2024-10-11T09:05:59.733876Z",
            "url": "https://files.pythonhosted.org/packages/86/f2/b518b738626dd0110085f2d796a57db24681db9d8908d002b91919ba50e4/xerosdk-0.14.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fa953e62606b5364aa5179b4978653ba8c879626996ad553016bb88033061805",
                "md5": "931314e5fabc7cddfcff640a873cfdff",
                "sha256": "708a3e7af51ddbb21681ae98d7102850c28bc6cba091499311b9ef11601426eb"
            },
            "downloads": -1,
            "filename": "xerosdk-0.14.2.tar.gz",
            "has_sig": false,
            "md5_digest": "931314e5fabc7cddfcff640a873cfdff",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11229,
            "upload_time": "2024-10-11T09:06:01",
            "upload_time_iso_8601": "2024-10-11T09:06:01.116883Z",
            "url": "https://files.pythonhosted.org/packages/fa/95/3e62606b5364aa5179b4978653ba8c879626996ad553016bb88033061805/xerosdk-0.14.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-11 09:06:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fylein",
    "github_project": "xero-sdk-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.31.0"
                ]
            ]
        }
    ],
    "lcname": "xerosdk"
}
        
Elapsed time: 0.36785s