Project

General

Profile

Statistics
| Revision:

root / trunk / docs / uporaba.rst @ 5

History | View | Annotate | Download (736 Bytes)

1 5 andrej.cim
Uporaba
2
================
3
4
Primeri uporabe web servisa za Python in SOAP knjižico Suds, ki jo namestimo z: ::
5
6
    sudo easy_install suds
7
8
Avtentikacija
9
-------------
10
::
11
12
    from suds.client import Client
13
    url = 'http://<webservice_host>/lidar/LIDAR?wsdl'
14
    client = Client(url)
15
16
    auth_token = client.service.getAuthenticationToken('<api_key>', '<username>', '<password>')
17
    if auth_token != None:
18
        print 'Authenticated! Auth token: %s' % auth_token
19
20
Zaklep
21
------
22
::
23
24
    lock_token = client.service.getLockToken(auth_token)
25
    if lock_token != None:
26
        print 'Locked! Lock token: %s' % lock_token
27
28
Odklep
29
------
30
::
31
32
    unlock = client.service.unlock(lock_token)
33
    if unlock:
34
        print 'Unlocked!'
35