Connects Xero to a database connector to transfer information to and fro.
Project description
Xero Database Connector
Connects Xero to a database to transfer information to and fro.
Installation
This project requires Python 3+.
-
Download this project and use it (copy it in your project, etc).
-
Install it from pip.
$ pip install xero-db-connector
Usage
To use this connector you'll need Xero credentials - specifically the keyfile and consumer key.
Here's example usage. Note the detect_types part - this is essential for timestamp to be translated to datetime.datetime type.
from xero_db_connector.extract import XeroExtractConnector
import sqlite3
import logging
from xero import Xero
from xero.auth import PrivateCredentials
logging.basicConfig(
format='%(asctime)s %(name)s: %(message)s', level=logging.INFO)
dbconn = sqlite3.connect("/tmp/xero.db", detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
xero_keyfile = 'XXX'
xero_consumer_key = 'XXX'
with open(xero_keyfile) as keyfile:
rsa_key = keyfile.read()
credentials = PrivateCredentials(xero_consumer_key, rsa_key)
xero = Xero(credentials)
x = XeroExtractConnector(xero=xero, dbconn=dbconn)
x.create_tables()
x.extract_invoices()
Contribute
To contribute to this project follow the steps
- Fork and clone the repository.
- Run
pip install -r requirements.txt
- Setup pylint precommit hook
- Create a file
.git/hooks/pre-commit
- Copy and paste the following lines in the file -
#!/usr/bin/env bash git-pylint-commit-hook
- Create a file
License
This project is licensed under the MIT License - see the LICENSE file for details
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
Built Distribution
Close
Hashes for xero_db_connector-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a4d4fd58988658140ab475f4627fb9836e18036a7911ca32f4965d61e3199b0 |
|
MD5 | a94a7da2f46d9975ac04b1cc084a31b2 |
|
BLAKE2b-256 | 08045fbee52e9568b7b58e7e187e7aa71e6ddd8b6d75f8d6f6e7fe02d6877d03 |