Project

General

Profile

Statistics
| Revision:

root / trunk / docs / _build / html / uporaba.html @ 7

History | View | Annotate | Download (7.21 KB)

1

    
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4

    
5
<html xmlns="http://www.w3.org/1999/xhtml">
6
  <head>
7
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
    
9
    <title>Uporaba &mdash; LIDAR dokumentacija</title>
10
    <link rel="stylesheet" href="_static/nature.css" type="text/css" />
11
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
12
    <script type="text/javascript">
13
      var DOCUMENTATION_OPTIONS = {
14
        URL_ROOT:    '',
15
        VERSION:     '1.0.0',
16
        COLLAPSE_INDEX: false,
17
        FILE_SUFFIX: '.html',
18
        HAS_SOURCE:  true
19
      };
20
    </script>
21
    <script type="text/javascript" src="_static/jquery.js"></script>
22
    <script type="text/javascript" src="_static/underscore.js"></script>
23
    <script type="text/javascript" src="_static/doctools.js"></script>
24
    <script type="text/javascript" src="_static/translations.js"></script>
25
    <link rel="top" title="LIDAR dokumentacija" href="index.html" />
26
    <link rel="prev" title="API" href="api.html" /> 
27
  </head>
28
  <body>
29
    <div class="related">
30
      <h3>Navigacija</h3>
31
      <ul>
32
        <li class="right" style="margin-right: 10px">
33
          <a href="genindex.html" title="Splošni abecedni seznam"
34
             accesskey="I">abecedni seznam</a></li>
35
        <li class="right" >
36
          <a href="api.html" title="API"
37
             accesskey="P">nazaj</a> |</li>
38
        <li><a href="index.html">LIDAR dokumentacija</a> &raquo;</li> 
39
      </ul>
40
    </div>  
41

    
42
    <div class="document">
43
      <div class="documentwrapper">
44
        <div class="bodywrapper">
45
          <div class="body">
46
            
47
  <div class="section" id="uporaba">
48
<h1>Uporaba<a class="headerlink" href="#uporaba" title="Povezava na naslov"></a></h1>
49
<p>Primeri uporabe web servisa za Python in SOAP knjižico <a class="reference external" href="https://fedorahosted.org/suds/">SUDS</a>, ki jo namestimo z:</p>
50
<div class="highlight-python"><pre>sudo easy_install suds</pre>
51
</div>
52
<div class="section" id="nadzorni-modul">
53
<h2>Nadzorni modul<a class="headerlink" href="#nadzorni-modul" title="Povezava na naslov"></a></h2>
54
<p>Nadozrni modul skrbi za dostop do naprave.</p>
55
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">suds.client</span> <span class="kn">import</span> <span class="n">Client</span>
56
<span class="n">client</span> <span class="o">=</span> <span class="n">Client</span><span class="p">(</span><span class="n">url</span><span class="p">)</span>
57

    
58
<span class="n">url</span> <span class="o">=</span> <span class="s">&#39;http://&lt;webservice_host&gt;/lidar/LIDAR?wsdl&#39;</span>
59
<span class="n">api_key</span> <span class="o">=</span> <span class="s">&#39;api_key&#39;</span>
60
<span class="n">username</span> <span class="o">=</span> <span class="s">&#39;username&#39;</span>
61
<span class="n">password</span> <span class="o">=</span> <span class="s">&#39;password&#39;</span>
62
</pre></div>
63
</div>
64
<div class="section" id="avtentikacija">
65
<h3>Avtentikacija<a class="headerlink" href="#avtentikacija" title="Povezava na naslov"></a></h3>
66
<div class="highlight-python"><div class="highlight"><pre><span class="n">auth_token</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">service</span><span class="o">.</span><span class="n">getAuthenticationToken</span><span class="p">(</span><span class="n">api_key</span><span class="p">,</span> <span class="n">username</span><span class="p">,</span> <span class="n">password</span><span class="p">)</span>
67
<span class="k">if</span> <span class="n">auth_token</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
68
    <span class="k">print</span> <span class="s">&#39;Authenticated! Auth token: </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">auth_token</span>
69
</pre></div>
70
</div>
71
</div>
72
<div class="section" id="zaklep">
73
<h3>Zaklep<a class="headerlink" href="#zaklep" title="Povezava na naslov"></a></h3>
74
<div class="highlight-python"><div class="highlight"><pre><span class="n">lock_token</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">service</span><span class="o">.</span><span class="n">getLockToken</span><span class="p">(</span><span class="n">auth_token</span><span class="p">)</span>
75
<span class="k">if</span> <span class="n">lock_token</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span>
76
    <span class="k">print</span> <span class="s">&#39;Locked! Lock token: </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">lock_token</span>
77
</pre></div>
78
</div>
79
</div>
80
<div class="section" id="odklep">
81
<h3>Odklep<a class="headerlink" href="#odklep" title="Povezava na naslov"></a></h3>
82
<div class="highlight-python"><div class="highlight"><pre><span class="n">unlock</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">service</span><span class="o">.</span><span class="n">unlock</span><span class="p">(</span><span class="n">lock_token</span><span class="p">)</span>
83
<span class="k">if</span> <span class="n">unlock</span><span class="p">:</span>
84
    <span class="k">print</span> <span class="s">&#39;Unlocked!&#39;</span>
85
</pre></div>
86
</div>
87
</div>
88
</div>
89
</div>
90

    
91

    
92
          </div>
93
        </div>
94
      </div>
95
      <div class="sphinxsidebar">
96
        <div class="sphinxsidebarwrapper">
97
  <h3><a href="index.html">Seznam Vsebine</a></h3>
98
  <ul>
99
<li><a class="reference internal" href="#">Uporaba</a><ul>
100
<li><a class="reference internal" href="#nadzorni-modul">Nadzorni modul</a><ul>
101
<li><a class="reference internal" href="#avtentikacija">Avtentikacija</a></li>
102
<li><a class="reference internal" href="#zaklep">Zaklep</a></li>
103
<li><a class="reference internal" href="#odklep">Odklep</a></li>
104
</ul>
105
</li>
106
</ul>
107
</li>
108
</ul>
109

    
110
  <h4>Prejšnja tema</h4>
111
  <p class="topless"><a href="api.html"
112
                        title="prejšnje poglavje">API</a></p>
113
<div id="searchbox" style="display: none">
114
  <h3>Hitro iskanje</h3>
115
    <form class="search" action="search.html" method="get">
116
      <input type="text" name="q" size="18" />
117
      <input type="submit" value="Potrdi" />
118
      <input type="hidden" name="check_keywords" value="yes" />
119
      <input type="hidden" name="area" value="default" />
120
    </form>
121
    <p class="searchtip" style="font-size: 90%">
122
    Vnesi ime modula, razreda ali funkcije.
123
    </p>
124
</div>
125
<script type="text/javascript">$('#searchbox').show(0);</script>
126
        </div>
127
      </div>
128
      <div class="clearer"></div>
129
    </div>
130
    <div class="related">
131
      <h3>Navigacija</h3>
132
      <ul>
133
        <li class="right" style="margin-right: 10px">
134
          <a href="genindex.html" title="Splošni abecedni seznam"
135
             >abecedni seznam</a></li>
136
        <li class="right" >
137
          <a href="api.html" title="API"
138
             >nazaj</a> |</li>
139
        <li><a href="index.html">LIDAR dokumentacija</a> &raquo;</li> 
140
      </ul>
141
    </div>
142
    <div class="footer">
143
        &copy; Vse pravice pridržane 2010, Andrej Cimperšek.
144
      Narejeno s <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0b2.
145
    </div>
146
  </body>
147
</html>