Project

General

Profile

Revision 6

View differences:

uporaba.rst
1 1
Uporaba
2 2
================
3 3

  
4
Primeri uporabe web servisa za Python in SOAP knjižico Suds, ki jo namestimo z: ::
4
Primeri uporabe web servisa za Python in SOAP knjižico `SUDS <https://fedorahosted.org/suds/>`_, ki jo namestimo z: ::
5 5

  
6 6
    sudo easy_install suds
7 7

  
8
Avtentikacija
9
-------------
8
Nadzorni modul
9
--------------
10
Nadozrni modul skrbi za dostop do naprave.
10 11
::
11 12

  
12 13
    from suds.client import Client
13
    url = 'http://<webservice_host>/lidar/LIDAR?wsdl'
14 14
    client = Client(url)
15 15

  
16
    auth_token = client.service.getAuthenticationToken('<api_key>', '<username>', '<password>')
16
    url = 'http://<webservice_host>/lidar/LIDAR?wsdl'
17
    api_key = 'api_key'
18
    username = 'username'
19
    password = 'password'
20

  
21
Avtentikacija
22
^^^^^^^^^^^^^
23
::
24

  
25
    auth_token = client.service.getAuthenticationToken(api_key, username, password)
17 26
    if auth_token != None:
18 27
        print 'Authenticated! Auth token: %s' % auth_token
19 28
    
20 29
Zaklep
21
------
30
^^^^^^
22 31
::
23 32

  
24 33
    lock_token = client.service.getLockToken(auth_token)
......
26 35
        print 'Locked! Lock token: %s' % lock_token
27 36

  
28 37
Odklep
29
------
38
^^^^^^
30 39
::
31 40

  
32 41
    unlock = client.service.unlock(lock_token)

Also available in: Unified diff