forked from rodneyrd/py-ispconfig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
views.py
44 lines (34 loc) · 1.39 KB
/
views.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# -*- coding:Utf-8 -*-
from SOAPpy import SOAP
from SOAPpy import *
from pyispconfig import PyISPconfig
def index(request):
""" An example How to use the PyIspconfig wrapper """
#Connecting to Soap Server
ispconfig_api = PyISPconfig('127.0.0.1', 'admin', 'admin')
#Dictonnaries examples
dict = {"usertheme": "default",
"username": "user1",
"company_name": "user1",
"password": "user1"}
dict_database_to_add = {"database_name": "db_user1",
"database_user": "db_user1",
"database_password": "db_user1", }
dict_database_to_update = {"database_user": "db_user1update",
"database_password": "db_user1update", }
#Add a new client and return the id.
new_client = ispconfig_api.client_add(dict)
if new_client :
#New client's id
print new_client
else:
#Error message if error
print ispconfig_api.error_message
#Add database to for user's ID 13
ispconfig_api.sites_database_add(13, dict_database_to_add)
#Get database's list of user's ID 13
print ispconfig_api.sites_database_get_all_by_user(13)
#Update database of user's ID 13
print ispconfig_api.sites_database_update(13, dict_database)
#Change password of user's ID 13
print ispconfig_api.client_change_password(13, "newpassword")