https://github.com/null-none/py-whmcs
Python client library and command line interface for WHMCS hosting management system
https://github.com/null-none/py-whmcs
api python whmcs whmcs-api
Last synced: 3 months ago
JSON representation
Python client library and command line interface for WHMCS hosting management system
- Host: GitHub
- URL: https://github.com/null-none/py-whmcs
- Owner: null-none
- License: gpl-3.0
- Created: 2022-06-08T16:24:30.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-09-15T18:49:58.000Z (over 2 years ago)
- Last Synced: 2025-01-26T09:28:33.894Z (4 months ago)
- Topics: api, python, whmcs, whmcs-api
- Language: Python
- Homepage:
- Size: 34.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# py-whmcs
py-whmcs is a Python interface to the WHMCS REST API.
## Usage
Create a WHMCS interface with the API URL and credentials and use it to
call the API.```python
import whmcspywhmcs = 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://py-whmcs.readthedocs.io/en/latest/whmcspy.html#whmcspy.api.WHMCS.call
[paginated_call()]: https://py-whmcs.readthedocs.io/en/latest/whmcspy.html#whmcspy.api.WHMCS.paginated_call