Python interface to the WHMCS API.
Project description
# WHMCSpy
WHMCSpy is a Python interface to the WHMCS REST API.
[](https://badge.fury.io/py/whmcspy)
[](https://whmcspy.readthedocs.io/en/latest/?badge=latest)
## Usage
Create a WHMCS interface with the API URL and credentials and use it to
call the API.
```python
import whmcspy
whmcs = whmcspy.WHMCS(
'https://example.com/whmcs/includes/api.php',
'identifier',
'secret')
whmcs.accept_order(2)
```
In general API methods can be called as methods in the WHMCS class. For
available API methods see the [WHMCS API reference](
https://developers.whmcs.com/api-reference/).
Note that the casing of the methods differ from the API actions. While the
API actions are CamelCased the methods are snake_cased.
### Calling unimplemented actions
Not all API actions are implemented as Python methods (they will be
implemented as required, of course pull-requests are accepted). In order to
call actions that are not yet implemented [call()] can be used. Example:
```python
response = whmcs.call(
'SomeAction',
param=value,
list_param=[
element,
element2,
]
)
```
See the [call()] documentation for more info.
Some actions return batches of results. To iterate over all results multiple
requests need to be done. For this a convenience method is added:
[paginated_call()]
This method is a generator which yields batches. Using keywords additional
params are accepted. Example:
```python
for response in whmcs.paginated_call(
'GetOrders'):
for order in response['orders']['order']:
print(order)
```
[call()]: https://whmcspy.readthedocs.io/en/latest/whmcspy.html#whmcspy.api.WHMCS.call
[paginated_call()]: https://whmcspy.readthedocs.io/en/latest/whmcspy.html#whmcspy.api.WHMCS.paginated_call
WHMCSpy is a Python interface to the WHMCS REST API.
[](https://badge.fury.io/py/whmcspy)
[](https://whmcspy.readthedocs.io/en/latest/?badge=latest)
## Usage
Create a WHMCS interface with the API URL and credentials and use it to
call the API.
```python
import whmcspy
whmcs = whmcspy.WHMCS(
'https://example.com/whmcs/includes/api.php',
'identifier',
'secret')
whmcs.accept_order(2)
```
In general API methods can be called as methods in the WHMCS class. For
available API methods see the [WHMCS API reference](
https://developers.whmcs.com/api-reference/).
Note that the casing of the methods differ from the API actions. While the
API actions are CamelCased the methods are snake_cased.
### Calling unimplemented actions
Not all API actions are implemented as Python methods (they will be
implemented as required, of course pull-requests are accepted). In order to
call actions that are not yet implemented [call()] can be used. Example:
```python
response = whmcs.call(
'SomeAction',
param=value,
list_param=[
element,
element2,
]
)
```
See the [call()] documentation for more info.
Some actions return batches of results. To iterate over all results multiple
requests need to be done. For this a convenience method is added:
[paginated_call()]
This method is a generator which yields batches. Using keywords additional
params are accepted. Example:
```python
for response in whmcs.paginated_call(
'GetOrders'):
for order in response['orders']['order']:
print(order)
```
[call()]: https://whmcspy.readthedocs.io/en/latest/whmcspy.html#whmcspy.api.WHMCS.call
[paginated_call()]: https://whmcspy.readthedocs.io/en/latest/whmcspy.html#whmcspy.api.WHMCS.paginated_call
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
whmcspy-0.3.0.tar.gz
(5.6 kB
view details)
Built Distribution
File details
Details for the file whmcspy-0.3.0.tar.gz
.
File metadata
- Download URL: whmcspy-0.3.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
49e325074a051fa6b200d17028d62cf6c78ac54fc3bbe0a3d3f0ef263a7207a1
|
|
MD5 |
2e2615348edac8be976816da30d5852f
|
|
BLAKE2b-256 |
4c6bf918878e395a92bfe303be6c1124d662390e57cde571b1c29729121f178d
|
File details
Details for the file whmcspy-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: whmcspy-0.3.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
9e4caae34dc9dbdb2cbff24d6e86a413d6f9efd5134fd418bd3aa6881c1b2483
|
|
MD5 |
15629d3d76424e8a914f1b30d6b49069
|
|
BLAKE2b-256 |
2dafa3d154020bd977ffc60fd0c6291503b694a23faae7ead92de970ded2101d
|