summaryrefslogtreecommitdiff
path: root/python-pyxero.spec
diff options
context:
space:
mode:
Diffstat (limited to 'python-pyxero.spec')
-rw-r--r--python-pyxero.spec345
1 files changed, 345 insertions, 0 deletions
diff --git a/python-pyxero.spec b/python-pyxero.spec
new file mode 100644
index 0000000..8041c97
--- /dev/null
+++ b/python-pyxero.spec
@@ -0,0 +1,345 @@
+%global _empty_manifest_terminate_build 0
+Name: python-pyxero
+Version: 0.9.3
+Release: 1
+Summary: Python API for accessing the REST API of the Xero accounting tool.
+License: New BSD
+URL: http://github.com/freakboy3742/pyxero
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/e2/55/b346563e254dd9a676745377b04d44d16d1d836cd96649e5fb3d0609c9f7/pyxero-0.9.3.tar.gz
+BuildArch: noarch
+
+Requires: python3-six
+Requires: python3-requests
+Requires: python3-requests-oauthlib
+Requires: python3-dateutil
+Requires: python3-PyJWT
+Requires: python3-cryptography
+
+%description
+[![Python Versions](https://img.shields.io/pypi/pyversions/pyxero.svg)](https://pypi.python.org/pypi/pyxero) [![PyPI Version](https://img.shields.io/pypi/v/pyxero.svg)](https://pypi.python.org/pypi/pyxero) [![Maturity](https://img.shields.io/pypi/status/pyxero.svg)](https://pypi.python.org/pypi/pyxero) [![BSD License](https://img.shields.io/pypi/l/pyxero.svg)](https://github.com/freakboy3742/pyxero/blob/master/LICENSE) [![Build Status](https://github.com/freakboy3742/pyxero/workflows/Build%20status/badge.svg)](https://github.com/freakboy3742/pyxero/actions)
+PyXero is a Python API for accessing the REST API provided by the [Xero](https://developer.xero.com)
+accounting tool. It allows access to both Public, Private and Partner applications.
+## Quickstart:
+Install this library using the python package manager:
+```
+pip install pyxero
+```
+You'll need to follow the [Xero Developer documentation](https://developer.xero.com/documentation/) to register your application. Do that as follows:
+### Public Applications
+Public applications use a 3-step OAuth process.
+When you [register your public application with Xero](https://developer.xero.com/documentation/auth-and-limits/public-applications/), you'll be given a
+**Consumer Key** and a **Consumer secret**. These are both strings.
+To access the Xero API you must first create some credentials:
+```python
+>>> from xero.auth import PublicCredentials
+>>> credentials = PublicCredentials(<consumer_key>, <consumer_secret>)
+>>> print credentials.url
+'http://my.xero.com/.....'
+```
+You now direct the user to visit the URL described by `credentials.url`. They
+will be asked to log into their Xero account, and then shown a request to
+authenticate your request to access the user's account. When the allow access,
+they will be directed to a page that gives them a 6-digit verification number.
+Put this verifier number into a string, and call `verify()` on the credentials
+object::
+```python
+>>> credentials.verify(<verifier string>)
+```
+This will verify your credentials, and retrieve an access token. You can
+then use your credentials to instantiate an instance of the Xero API::
+```python
+>>> from xero import Xero
+>>> xero = Xero(credentials)
+```
+### Public Applications with verification by callback
+Public applications can also be validated using a callback URI. If this
+approach is used, the user won't be given a verification number. Instead,
+when they authorize the OAuth request, their browser will be redirected to
+a pre-configured callback URI, which will deliver the validation token
+directly to your application.
+To use a callback, you must provide a domain as part of your Xero application
+registration; then, you provide a URL under that domain as the third argument
+when creating the credentials::
+```python
+>>> credentials = PublicCredentials(<consumer_key>, <consumer_secret>, <callback_uri>)
+>>> print credentials.url
+'http://my.xero.com/.....'
+```
+When the user authorizes access to their Xero account, the `callback_url`
+will be called with three GET arguments:
+* `oauth_token`: The oauth_token that this request belongs to
+* `oauth_verifier`: The verifier string
+* `org`: An identifier for the organization that is allowing access.
+The verifier can then be used to verify the credentials, as with the manual
+process.
+### Reconstructing Public credentials
+Public Applications use a 3-step OAuth process, and if you're doing this in a
+web application, you will usually lose the credentials object over the
+verification step. This means you need to be able to restore the credentials
+object when verification has been provided.
+The `state` attribute of a credentials object contains all the details needed
+to reconstruct an instance of the credentials::
+```python
+>>> saved_state = credentials.state
+>>> print saved_state
+{'consumer_key': '...', 'consumer_secret': '...', ...}
+>>> new_credentials = PublicCredentials(**saved_state)
+```
+### Private Applications
+*Private Applications are deprecated by Xero*. An alternative is to use the machine-to-machine method. This is fundamentally an OAuth2 flow, but Xero provides a helper executable to get tokens from a local machine without needing a server to host a callback. See [Xero Machine to Machine authentication](https://developer.xero.com/documentation/api-guides/machine-2-machine)
+If using a Private application, you will need to install `PyCrypto`, a pure
+Python cryptographic module. You'll also need to generate an signed RSA
+certificate, and submit that certificate as part of registering your
+application with Xero. See the [Xero Developer documentation](https://developer.xero.com/) for more
+details.
+When you [register your private application with Xero](https://developer.xero.com/documentation/auth-and-limits/private-applications/), you'll be given a
+**Consumer Key**. You'll also be given a **Consumer secret** - this can be
+ignored.
+Using the Private credentials is much simpler than the Public credentials,
+because there's no verification step -- verification is managed using RSA
+signed API requests::
+```python
+>>> from xero import Xero
+>>> from xero.auth import PrivateCredentials
+>>> with open(<path to rsa key file>) as keyfile:
+>>> credentials = PrivateCredentials(<consumer_key>, rsa_key)
+>>> xero = Xero(credentials)
+```
+[Follow these steps](https://developer.xero.com/documentation/api-guides/create-publicprivate-key/) to generate a public/private key pair to sign your requests. You'll upload your public key when you create your Xero Private app at https://app.xero.com. You'll use the private key (aka RSA key) to generate your oAuth signature.
+
+%package -n python3-pyxero
+Summary: Python API for accessing the REST API of the Xero accounting tool.
+Provides: python-pyxero
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-pyxero
+[![Python Versions](https://img.shields.io/pypi/pyversions/pyxero.svg)](https://pypi.python.org/pypi/pyxero) [![PyPI Version](https://img.shields.io/pypi/v/pyxero.svg)](https://pypi.python.org/pypi/pyxero) [![Maturity](https://img.shields.io/pypi/status/pyxero.svg)](https://pypi.python.org/pypi/pyxero) [![BSD License](https://img.shields.io/pypi/l/pyxero.svg)](https://github.com/freakboy3742/pyxero/blob/master/LICENSE) [![Build Status](https://github.com/freakboy3742/pyxero/workflows/Build%20status/badge.svg)](https://github.com/freakboy3742/pyxero/actions)
+PyXero is a Python API for accessing the REST API provided by the [Xero](https://developer.xero.com)
+accounting tool. It allows access to both Public, Private and Partner applications.
+## Quickstart:
+Install this library using the python package manager:
+```
+pip install pyxero
+```
+You'll need to follow the [Xero Developer documentation](https://developer.xero.com/documentation/) to register your application. Do that as follows:
+### Public Applications
+Public applications use a 3-step OAuth process.
+When you [register your public application with Xero](https://developer.xero.com/documentation/auth-and-limits/public-applications/), you'll be given a
+**Consumer Key** and a **Consumer secret**. These are both strings.
+To access the Xero API you must first create some credentials:
+```python
+>>> from xero.auth import PublicCredentials
+>>> credentials = PublicCredentials(<consumer_key>, <consumer_secret>)
+>>> print credentials.url
+'http://my.xero.com/.....'
+```
+You now direct the user to visit the URL described by `credentials.url`. They
+will be asked to log into their Xero account, and then shown a request to
+authenticate your request to access the user's account. When the allow access,
+they will be directed to a page that gives them a 6-digit verification number.
+Put this verifier number into a string, and call `verify()` on the credentials
+object::
+```python
+>>> credentials.verify(<verifier string>)
+```
+This will verify your credentials, and retrieve an access token. You can
+then use your credentials to instantiate an instance of the Xero API::
+```python
+>>> from xero import Xero
+>>> xero = Xero(credentials)
+```
+### Public Applications with verification by callback
+Public applications can also be validated using a callback URI. If this
+approach is used, the user won't be given a verification number. Instead,
+when they authorize the OAuth request, their browser will be redirected to
+a pre-configured callback URI, which will deliver the validation token
+directly to your application.
+To use a callback, you must provide a domain as part of your Xero application
+registration; then, you provide a URL under that domain as the third argument
+when creating the credentials::
+```python
+>>> credentials = PublicCredentials(<consumer_key>, <consumer_secret>, <callback_uri>)
+>>> print credentials.url
+'http://my.xero.com/.....'
+```
+When the user authorizes access to their Xero account, the `callback_url`
+will be called with three GET arguments:
+* `oauth_token`: The oauth_token that this request belongs to
+* `oauth_verifier`: The verifier string
+* `org`: An identifier for the organization that is allowing access.
+The verifier can then be used to verify the credentials, as with the manual
+process.
+### Reconstructing Public credentials
+Public Applications use a 3-step OAuth process, and if you're doing this in a
+web application, you will usually lose the credentials object over the
+verification step. This means you need to be able to restore the credentials
+object when verification has been provided.
+The `state` attribute of a credentials object contains all the details needed
+to reconstruct an instance of the credentials::
+```python
+>>> saved_state = credentials.state
+>>> print saved_state
+{'consumer_key': '...', 'consumer_secret': '...', ...}
+>>> new_credentials = PublicCredentials(**saved_state)
+```
+### Private Applications
+*Private Applications are deprecated by Xero*. An alternative is to use the machine-to-machine method. This is fundamentally an OAuth2 flow, but Xero provides a helper executable to get tokens from a local machine without needing a server to host a callback. See [Xero Machine to Machine authentication](https://developer.xero.com/documentation/api-guides/machine-2-machine)
+If using a Private application, you will need to install `PyCrypto`, a pure
+Python cryptographic module. You'll also need to generate an signed RSA
+certificate, and submit that certificate as part of registering your
+application with Xero. See the [Xero Developer documentation](https://developer.xero.com/) for more
+details.
+When you [register your private application with Xero](https://developer.xero.com/documentation/auth-and-limits/private-applications/), you'll be given a
+**Consumer Key**. You'll also be given a **Consumer secret** - this can be
+ignored.
+Using the Private credentials is much simpler than the Public credentials,
+because there's no verification step -- verification is managed using RSA
+signed API requests::
+```python
+>>> from xero import Xero
+>>> from xero.auth import PrivateCredentials
+>>> with open(<path to rsa key file>) as keyfile:
+>>> credentials = PrivateCredentials(<consumer_key>, rsa_key)
+>>> xero = Xero(credentials)
+```
+[Follow these steps](https://developer.xero.com/documentation/api-guides/create-publicprivate-key/) to generate a public/private key pair to sign your requests. You'll upload your public key when you create your Xero Private app at https://app.xero.com. You'll use the private key (aka RSA key) to generate your oAuth signature.
+
+%package help
+Summary: Development documents and examples for pyxero
+Provides: python3-pyxero-doc
+%description help
+[![Python Versions](https://img.shields.io/pypi/pyversions/pyxero.svg)](https://pypi.python.org/pypi/pyxero) [![PyPI Version](https://img.shields.io/pypi/v/pyxero.svg)](https://pypi.python.org/pypi/pyxero) [![Maturity](https://img.shields.io/pypi/status/pyxero.svg)](https://pypi.python.org/pypi/pyxero) [![BSD License](https://img.shields.io/pypi/l/pyxero.svg)](https://github.com/freakboy3742/pyxero/blob/master/LICENSE) [![Build Status](https://github.com/freakboy3742/pyxero/workflows/Build%20status/badge.svg)](https://github.com/freakboy3742/pyxero/actions)
+PyXero is a Python API for accessing the REST API provided by the [Xero](https://developer.xero.com)
+accounting tool. It allows access to both Public, Private and Partner applications.
+## Quickstart:
+Install this library using the python package manager:
+```
+pip install pyxero
+```
+You'll need to follow the [Xero Developer documentation](https://developer.xero.com/documentation/) to register your application. Do that as follows:
+### Public Applications
+Public applications use a 3-step OAuth process.
+When you [register your public application with Xero](https://developer.xero.com/documentation/auth-and-limits/public-applications/), you'll be given a
+**Consumer Key** and a **Consumer secret**. These are both strings.
+To access the Xero API you must first create some credentials:
+```python
+>>> from xero.auth import PublicCredentials
+>>> credentials = PublicCredentials(<consumer_key>, <consumer_secret>)
+>>> print credentials.url
+'http://my.xero.com/.....'
+```
+You now direct the user to visit the URL described by `credentials.url`. They
+will be asked to log into their Xero account, and then shown a request to
+authenticate your request to access the user's account. When the allow access,
+they will be directed to a page that gives them a 6-digit verification number.
+Put this verifier number into a string, and call `verify()` on the credentials
+object::
+```python
+>>> credentials.verify(<verifier string>)
+```
+This will verify your credentials, and retrieve an access token. You can
+then use your credentials to instantiate an instance of the Xero API::
+```python
+>>> from xero import Xero
+>>> xero = Xero(credentials)
+```
+### Public Applications with verification by callback
+Public applications can also be validated using a callback URI. If this
+approach is used, the user won't be given a verification number. Instead,
+when they authorize the OAuth request, their browser will be redirected to
+a pre-configured callback URI, which will deliver the validation token
+directly to your application.
+To use a callback, you must provide a domain as part of your Xero application
+registration; then, you provide a URL under that domain as the third argument
+when creating the credentials::
+```python
+>>> credentials = PublicCredentials(<consumer_key>, <consumer_secret>, <callback_uri>)
+>>> print credentials.url
+'http://my.xero.com/.....'
+```
+When the user authorizes access to their Xero account, the `callback_url`
+will be called with three GET arguments:
+* `oauth_token`: The oauth_token that this request belongs to
+* `oauth_verifier`: The verifier string
+* `org`: An identifier for the organization that is allowing access.
+The verifier can then be used to verify the credentials, as with the manual
+process.
+### Reconstructing Public credentials
+Public Applications use a 3-step OAuth process, and if you're doing this in a
+web application, you will usually lose the credentials object over the
+verification step. This means you need to be able to restore the credentials
+object when verification has been provided.
+The `state` attribute of a credentials object contains all the details needed
+to reconstruct an instance of the credentials::
+```python
+>>> saved_state = credentials.state
+>>> print saved_state
+{'consumer_key': '...', 'consumer_secret': '...', ...}
+>>> new_credentials = PublicCredentials(**saved_state)
+```
+### Private Applications
+*Private Applications are deprecated by Xero*. An alternative is to use the machine-to-machine method. This is fundamentally an OAuth2 flow, but Xero provides a helper executable to get tokens from a local machine without needing a server to host a callback. See [Xero Machine to Machine authentication](https://developer.xero.com/documentation/api-guides/machine-2-machine)
+If using a Private application, you will need to install `PyCrypto`, a pure
+Python cryptographic module. You'll also need to generate an signed RSA
+certificate, and submit that certificate as part of registering your
+application with Xero. See the [Xero Developer documentation](https://developer.xero.com/) for more
+details.
+When you [register your private application with Xero](https://developer.xero.com/documentation/auth-and-limits/private-applications/), you'll be given a
+**Consumer Key**. You'll also be given a **Consumer secret** - this can be
+ignored.
+Using the Private credentials is much simpler than the Public credentials,
+because there's no verification step -- verification is managed using RSA
+signed API requests::
+```python
+>>> from xero import Xero
+>>> from xero.auth import PrivateCredentials
+>>> with open(<path to rsa key file>) as keyfile:
+>>> credentials = PrivateCredentials(<consumer_key>, rsa_key)
+>>> xero = Xero(credentials)
+```
+[Follow these steps](https://developer.xero.com/documentation/api-guides/create-publicprivate-key/) to generate a public/private key pair to sign your requests. You'll upload your public key when you create your Xero Private app at https://app.xero.com. You'll use the private key (aka RSA key) to generate your oAuth signature.
+
+%prep
+%autosetup -n pyxero-0.9.3
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-pyxero -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 0.9.3-1
+- Package Spec generated