pyhamtools/docs/build/html/lookuplib.html

324 lines
14 KiB
HTML
Raw Normal View History

2014-04-24 14:01:53 +02:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LookupLib &mdash; pyhamtools 0.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="pyhamtools 0.1 documentation" href="index.html" />
<link rel="prev" title="PyHamTools" href="index.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="index.html" title="PyHamTools"
accesskey="P">previous</a> |</li>
<li><a href="index.html">pyhamtools 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="lookuplib">
<h1>LookupLib<a class="headerlink" href="#lookuplib" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
<ul class="simple">
</ul>
</div>
<span class="target" id="module-pyhamtools.lookuplib"></span><dl class="class">
<dt id="pyhamtools.lookuplib.LookupLib">
<em class="property">class </em><tt class="descclassname">pyhamtools.lookuplib.</tt><tt class="descname">LookupLib</tt><big>(</big><em>lookuptype='clublogxml'</em>, <em>apikey=None</em>, <em>filename=None</em>, <em>logger=None</em><big>)</big><a class="headerlink" href="#pyhamtools.lookuplib.LookupLib" title="Permalink to this definition"></a></dt>
<dd><p>This class provides a homogeneous interface to three different Amateur Radio Callsign lookup sources:</p>
<ol class="arabic simple">
<li>Clublog.org (daily updated XML File)</li>
<li>Clublog.org (HTTPS lookup)</li>
<li>Country-files.com (infrequently updated PLIST File)</li>
</ol>
<p>The class provides getters to access the data in a structured way. Even the interface is the same
for all lookup sources, the returning data can be different. The documentation of the various
methods provide more detail.</p>
<p>By default, LookupLib requires an Internet connection to download the libraries or perform the
lookup against the Clublog API.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>lookuptype</strong> (<em>str</em>) &#8211; &#8220;clublogxml&#8221; or &#8220;clublogapi&#8221; or &#8220;countryfile&#8221;</li>
<li><strong>apikey</strong> (<em>str</em>) &#8211; Clublog API Key</li>
<li><strong>filename</strong> (<em>str, optional</em>) &#8211; Filename for Clublog XML or Country-files.com cty.plist file</li>
<li><strong>logger</strong> (<em>logging.getLogger(__name__), optional</em>) &#8211; Python logger</li>
</ul>
2014-04-24 14:01:53 +02:00
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="pyhamtools.lookuplib.LookupLib.is_invalid_operation">
2014-04-24 17:46:46 +02:00
<tt class="descname">is_invalid_operation</tt><big>(</big><em>callsign</em>, <em>timestamp=datetime.datetime(2014</em>, <em>4</em>, <em>24</em>, <em>15</em>, <em>46</em>, <em>11</em>, <em>956076</em>, <em>tzinfo=&lt;UTC&gt;)</em><big>)</big><a class="headerlink" href="#pyhamtools.lookuplib.LookupLib.is_invalid_operation" title="Permalink to this definition"></a></dt>
2014-04-24 14:01:53 +02:00
<dd><p>Returns True if an operations is known as invalid</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>callsign</strong> (<em>string</em>) &#8211; Amateur Radio callsign</li>
<li><strong>timestamp</strong> (<em>datetime, optional</em>) &#8211; datetime in UTC (tzinfo=pytz.UTC)</li>
</ul>
2014-04-24 14:01:53 +02:00
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">True if a record exists for this callsign (at the given time)</p>
2014-04-24 14:01:53 +02:00
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">bool</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
2014-04-24 17:46:46 +02:00
<li><tt class="xref py py-exc docutils literal"><span class="pre">NoResult</span></tt> &#8211;
No matching callsign found</li>
2014-04-24 17:46:46 +02:00
<li><tt class="xref py py-exc docutils literal"><span class="pre">APIKeyMissingError</span></tt> &#8211;
API Key for Clublog missing or incorrect</li>
</ul>
2014-04-24 14:01:53 +02:00
</td>
</tr>
</tbody>
</table>
2014-04-24 17:46:46 +02:00
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>This method is available for</p>
<ul class="last simple">
2014-04-24 14:01:53 +02:00
<li>clublogxml</li>
</ul>
2014-04-24 17:46:46 +02:00
</div>
2014-04-24 14:01:53 +02:00
</dd></dl>
<dl class="method">
<dt id="pyhamtools.lookuplib.LookupLib.lookup_callsign">
2014-04-24 17:46:46 +02:00
<tt class="descname">lookup_callsign</tt><big>(</big><em>callsign=None</em>, <em>timestamp=datetime.datetime(2014</em>, <em>4</em>, <em>24</em>, <em>15</em>, <em>46</em>, <em>11</em>, <em>956058</em>, <em>tzinfo=&lt;UTC&gt;)</em><big>)</big><a class="headerlink" href="#pyhamtools.lookuplib.LookupLib.lookup_callsign" title="Permalink to this definition"></a></dt>
2014-04-24 14:01:53 +02:00
<dd><p>Returns lookup data if an exception exists for a callsign</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>callsign</strong> (<em>string</em>) &#8211; Amateur radio callsign</li>
<li><strong>timestamp</strong> (<em>datetime, optional</em>) &#8211; datetime in UTC (tzinfo=pytz.UTC)</li>
</ul>
2014-04-24 14:01:53 +02:00
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Dictionary containing the country specific data of the callsign</p>
2014-04-24 14:01:53 +02:00
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">dict</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
2014-04-24 17:46:46 +02:00
<li><tt class="xref py py-exc docutils literal"><span class="pre">NoResult</span></tt> &#8211;
No matching callsign found</li>
2014-04-24 17:46:46 +02:00
<li><tt class="xref py py-exc docutils literal"><span class="pre">APIKeyMissingError</span></tt> &#8211;
API Key for Clublog missing or incorrect</li>
</ul>
2014-04-24 14:01:53 +02:00
</td>
</tr>
</tbody>
</table>
2014-04-24 17:46:46 +02:00
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>This method is available for</p>
<ul class="last simple">
2014-04-24 14:01:53 +02:00
<li>clublogxml</li>
<li>clublogapi</li>
<li>countryfile</li>
</ul>
2014-04-24 17:46:46 +02:00
</div>
2014-04-24 14:01:53 +02:00
</dd></dl>
<dl class="method">
<dt id="pyhamtools.lookuplib.LookupLib.lookup_entity">
<tt class="descname">lookup_entity</tt><big>(</big><em>entity=None</em><big>)</big><a class="headerlink" href="#pyhamtools.lookuplib.LookupLib.lookup_entity" title="Permalink to this definition"></a></dt>
<dd><p>Returns lookup data of a ADIF Entity</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>entity</strong> (<em>int</em>) &#8211; ADIF identifier of country</td>
2014-04-24 14:01:53 +02:00
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Dictionary containing the country specific data</td>
2014-04-24 14:01:53 +02:00
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">dict</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><tt class="xref py py-exc docutils literal"><span class="pre">NoResult</span></tt> &#8211;
No matching entity found</td>
2014-04-24 14:01:53 +02:00
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
2014-04-24 17:46:46 +02:00
<p>This method is available for the following lookup type</p>
<ul class="last simple">
2014-04-24 14:01:53 +02:00
<li>clublogxml</li>
</ul>
</div>
2014-04-24 14:01:53 +02:00
</dd></dl>
<dl class="method">
<dt id="pyhamtools.lookuplib.LookupLib.lookup_prefix">
2014-04-24 17:46:46 +02:00
<tt class="descname">lookup_prefix</tt><big>(</big><em>prefix</em>, <em>timestamp=datetime.datetime(2014</em>, <em>4</em>, <em>24</em>, <em>15</em>, <em>46</em>, <em>11</em>, <em>956058</em>, <em>tzinfo=&lt;UTC&gt;)</em><big>)</big><a class="headerlink" href="#pyhamtools.lookuplib.LookupLib.lookup_prefix" title="Permalink to this definition"></a></dt>
2014-04-24 14:01:53 +02:00
<dd><p>Returns lookup data of a Prefix</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>prefix</strong> (<em>string</em>) &#8211; Prefix of a Amateur Radio callsign</li>
<li><strong>timestamp</strong> (<em>datetime, optional</em>) &#8211; datetime in UTC (tzinfo=pytz.UTC)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Dictionary containing the country specific data of the Prefix</p>
2014-04-24 14:01:53 +02:00
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">dict</p>
2014-04-24 14:01:53 +02:00
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
2014-04-24 17:46:46 +02:00
<li><tt class="xref py py-exc docutils literal"><span class="pre">NoResult</span></tt> &#8211;
No matching Prefix found</li>
2014-04-24 17:46:46 +02:00
<li><tt class="xref py py-exc docutils literal"><span class="pre">APIKeyMissingError</span></tt> &#8211;
API Key for Clublog missing or incorrect</li>
</ul>
2014-04-24 14:01:53 +02:00
</td>
</tr>
</tbody>
</table>
2014-04-24 17:46:46 +02:00
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>This method is available for</p>
<ul class="last simple">
2014-04-24 14:01:53 +02:00
<li>clublogxml</li>
<li>countryfile</li>
</ul>
2014-04-24 17:46:46 +02:00
</div>
2014-04-24 14:01:53 +02:00
</dd></dl>
<dl class="method">
<dt id="pyhamtools.lookuplib.LookupLib.lookup_zone_exception">
2014-04-24 17:46:46 +02:00
<tt class="descname">lookup_zone_exception</tt><big>(</big><em>callsign</em>, <em>timestamp=datetime.datetime(2014</em>, <em>4</em>, <em>24</em>, <em>15</em>, <em>46</em>, <em>11</em>, <em>956082</em>, <em>tzinfo=&lt;UTC&gt;)</em><big>)</big><a class="headerlink" href="#pyhamtools.lookuplib.LookupLib.lookup_zone_exception" title="Permalink to this definition"></a></dt>
2014-04-24 14:01:53 +02:00
<dd><p>Returns a CQ Zone if an exception exists for the given callsign</p>
2014-04-24 17:46:46 +02:00
<p>Args:
callsign (string): Amateur radio callsign
timestamp (datetime, optional): datetime in UTC (tzinfo=pytz.UTC)</p>
2014-04-24 14:01:53 +02:00
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
2014-04-24 17:46:46 +02:00
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Value of the the CQ Zone exception which exists for this callsign (at the given time)</p>
2014-04-24 14:01:53 +02:00
</td>
</tr>
2014-04-24 17:46:46 +02:00
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">int</p>
</td>
</tr>
2014-04-24 17:46:46 +02:00
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><tt class="xref py py-exc docutils literal"><span class="pre">NoResult</span></tt> &#8211;
No matching callsign found</li>
2014-04-24 17:46:46 +02:00
<li><tt class="xref py py-exc docutils literal"><span class="pre">APIKeyMissingError</span></tt> &#8211;
API Key for Clublog missing or incorrect</li>
</ul>
2014-04-24 14:01:53 +02:00
</td>
</tr>
</tbody>
</table>
2014-04-24 17:46:46 +02:00
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>This method is available for</p>
<ul class="last simple">
2014-04-24 14:01:53 +02:00
<li>clublogxml</li>
</ul>
2014-04-24 17:46:46 +02:00
</div>
2014-04-24 14:01:53 +02:00
</dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="index.html"
title="previous chapter">PyHamTools</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/LookupLib.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="index.html" title="PyHamTools"
>previous</a> |</li>
<li><a href="index.html">pyhamtools 0.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2014, Tobias Wellnitz, DH1TW.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>