root / trunk / docs / _build / html / uporaba.html @ 5
History | View | Annotate | Download (6.54 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 — 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> »</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 Suds, ki jo namestimo z:</p> |
50 |
<div class="highlight-python"><pre>sudo easy_install suds</pre> |
51 |
</div>
|
52 |
<div class="section" id="avtentikacija"> |
53 |
<h2>Avtentikacija<a class="headerlink" href="#avtentikacija" title="Povezava na naslov">¶</a></h2> |
54 |
<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> |
55 |
<span class="n">url</span> <span class="o">=</span> <span class="s">'http://<webservice_host>/lidar/LIDAR?wsdl'</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">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="s">'<api_key>'</span><span class="p">,</span> <span class="s">'<username>'</span><span class="p">,</span> <span class="s">'<password>'</span><span class="p">)</span> |
59 |
<span class="k">if</span> <span class="n">auth_token</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span> |
60 |
<span class="k">print</span> <span class="s">'Authenticated! Auth token: </span><span class="si">%s</span><span class="s">'</span> <span class="o">%</span> <span class="n">auth_token</span> |
61 |
</pre></div> |
62 |
</div>
|
63 |
</div>
|
64 |
<div class="section" id="zaklep"> |
65 |
<h2>Zaklep<a class="headerlink" href="#zaklep" title="Povezava na naslov">¶</a></h2> |
66 |
<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> |
67 |
<span class="k">if</span> <span class="n">lock_token</span> <span class="o">!=</span> <span class="bp">None</span><span class="p">:</span> |
68 |
<span class="k">print</span> <span class="s">'Locked! Lock token: </span><span class="si">%s</span><span class="s">'</span> <span class="o">%</span> <span class="n">lock_token</span> |
69 |
</pre></div> |
70 |
</div>
|
71 |
</div>
|
72 |
<div class="section" id="odklep"> |
73 |
<h2>Odklep<a class="headerlink" href="#odklep" title="Povezava na naslov">¶</a></h2> |
74 |
<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> |
75 |
<span class="k">if</span> <span class="n">unlock</span><span class="p">:</span> |
76 |
<span class="k">print</span> <span class="s">'Unlocked!'</span> |
77 |
</pre></div> |
78 |
</div>
|
79 |
</div>
|
80 |
</div>
|
81 |
|
82 |
|
83 |
</div>
|
84 |
</div>
|
85 |
</div>
|
86 |
<div class="sphinxsidebar"> |
87 |
<div class="sphinxsidebarwrapper"> |
88 |
<h3><a href="index.html">Seznam Vsebine</a></h3> |
89 |
<ul>
|
90 |
<li><a class="reference internal" href="#">Uporaba</a><ul> |
91 |
<li><a class="reference internal" href="#avtentikacija">Avtentikacija</a></li> |
92 |
<li><a class="reference internal" href="#zaklep">Zaklep</a></li> |
93 |
<li><a class="reference internal" href="#odklep">Odklep</a></li> |
94 |
</ul>
|
95 |
</li>
|
96 |
</ul>
|
97 |
|
98 |
<h4>Prejšnja tema</h4> |
99 |
<p class="topless"><a href="api.html" |
100 |
title="prejšnje poglavje">API</a></p> |
101 |
<div id="searchbox" style="display: none"> |
102 |
<h3>Hitro iskanje</h3> |
103 |
<form class="search" action="search.html" method="get"> |
104 |
<input type="text" name="q" size="18" /> |
105 |
<input type="submit" value="Potrdi" /> |
106 |
<input type="hidden" name="check_keywords" value="yes" /> |
107 |
<input type="hidden" name="area" value="default" /> |
108 |
</form>
|
109 |
<p class="searchtip" style="font-size: 90%"> |
110 |
Vnesi ime modula, razreda ali funkcije. |
111 |
</p>
|
112 |
</div>
|
113 |
<script type="text/javascript">$('#searchbox').show(0);</script> |
114 |
</div>
|
115 |
</div>
|
116 |
<div class="clearer"></div> |
117 |
</div>
|
118 |
<div class="related"> |
119 |
<h3>Navigacija</h3> |
120 |
<ul>
|
121 |
<li class="right" style="margin-right: 10px"> |
122 |
<a href="genindex.html" title="Splošni abecedni seznam" |
123 |
>abecedni seznam</a></li> |
124 |
<li class="right" > |
125 |
<a href="api.html" title="API" |
126 |
>nazaj</a> |</li> |
127 |
<li><a href="index.html">LIDAR dokumentacija</a> »</li> |
128 |
</ul>
|
129 |
</div>
|
130 |
<div class="footer"> |
131 |
© Vse pravice pridržane 2010, Andrej Cimperšek.
|
132 |
Narejeno s <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0b2. |
133 |
</div>
|
134 |
</body>
|
135 |
</html>
|