sample.py 867 Bytes
Newer Older
Gregory Cugat's avatar
Gregory Cugat committed
1 2 3
#!/usr/bin/python
# -*-coding:Utf-8 -*
##########################################################
4
from SOLIDserverRest import *
Gregory Cugat's avatar
Gregory Cugat committed
5 6 7

print("")
print("################")
8
print("Tests")
Gregory Cugat's avatar
Gregory Cugat committed
9 10 11 12 13
print("################")
print("")

print("Object declaration")
print("-------------------")
Gregory Cugat's avatar
Gregory Cugat committed
14
print('your_obj = SOLIDServerRest("host", "user", "password")')
15 16 17
con = SOLIDserverRest('192.168.56.254')
try:
    con.useNativeSSD(user="api", password="admin")
18
except SDSInitError:
19 20
    exit()

Gregory Cugat's avatar
Gregory Cugat committed
21 22 23 24 25 26
print("-------------------")
print("")

print("Query parameter's setting")
print("-------------------")
print("EXAMPLE: FIXME")
Gregory Cugat's avatar
Gregory Cugat committed
27
parameters = {'site_name': 'toto', 'site_description': 'site description'}
Gregory Cugat's avatar
Gregory Cugat committed
28 29 30 31 32
print("-------------------")
print("")

print('...')

33
answerR = con.query('ip_site_update', parameters)
Gregory Cugat's avatar
Gregory Cugat committed
34

Gregory Cugat's avatar
Gregory Cugat committed
35 36 37 38 39
print("")
print("REPONSE")
print(answerR)
print(answerR.status_code)
print(answerR.content)