diff options
| author | Devendra | 2014-06-25 23:01:13 +0530 | 
|---|---|---|
| committer | Devendra | 2014-06-25 23:01:13 +0530 | 
| commit | 2b28091386dc4b3597b56b773254056185b0c6e0 (patch) | |
| tree | 0b45f1b318e8e7e22f14e458302da458f940c726 /docs/build/html/index.html | |
| parent | 1f98c4087f09bf4384be71319b93dedf72d3acdf (diff) | |
| download | pubnub-python-2b28091386dc4b3597b56b773254056185b0c6e0.tar.bz2 | |
[#73858464] adding sphinx docsPT-73858464
Diffstat (limited to 'docs/build/html/index.html')
| -rw-r--r-- | docs/build/html/index.html | 1555 | 
1 files changed, 1555 insertions, 0 deletions
| diff --git a/docs/build/html/index.html b/docs/build/html/index.html new file mode 100644 index 0000000..e183435 --- /dev/null +++ b/docs/build/html/index.html @@ -0,0 +1,1555 @@ +<!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>Welcome to PubNub’s documentation! — PubNub 3.5.2 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:     '3.5.2', +        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="PubNub 3.5.2 documentation" href="#" />  +  </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><a href="#">PubNub 3.5.2 documentation</a> »</li>  +      </ul> +    </div>   + +    <div class="document"> +      <div class="documentwrapper"> +        <div class="bodywrapper"> +          <div class="body"> +             +  <div class="section" id="welcome-to-pubnub-s-documentation"> +<h1>Welcome to PubNub’s documentation!<a class="headerlink" href="#welcome-to-pubnub-s-documentation" title="Permalink to this headline">¶</a></h1> +<div class="toctree-wrapper compound"> +<ul class="simple"> +</ul> +</div> +<span class="target" id="module-Pubnub"></span><div class="section" id="pubnub"> +<h2>Pubnub<a class="headerlink" href="#pubnub" title="Permalink to this headline">¶</a></h2> +<dl class="class"> +<dt id="Pubnub.Pubnub"> +<em class="property">class </em><tt class="descclassname">Pubnub.</tt><tt class="descname">Pubnub</tt><big>(</big><em>publish_key</em>, <em>subscribe_key</em>, <em>secret_key=None</em>, <em>cipher_key=None</em>, <em>auth_key=None</em>, <em>ssl_on=False</em>, <em>origin='pubsub.pubnub.com'</em>, <em>uuid=None</em>, <em>pooling=True</em>, <em>pres_uuid=None</em><big>)</big><a class="headerlink" href="#Pubnub.Pubnub" title="Permalink to this definition">¶</a></dt> +<dd><dl class="method"> +<dt id="Pubnub.Pubnub.audit"> +<tt class="descname">audit</tt><big>(</big><em>channel=None</em>, <em>auth_key=None</em>, <em>callback=None</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.Pubnub.audit" title="Permalink to this definition">¶</a></dt> +<dd><p>Method for fetching permissions from pubnub servers.</p> +<p>This method provides a mechanism to reveal existing PubNub Access Manager attributes +for any combination of subscribe_key, channel and auth_key.</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string) (optional)</dt> +<dd>Specifies channel name to return PAM  +attributes optionally in combination with auth_key. +If channel is not specified, results for all channels +associated with subscribe_key are returned. +If auth_key is not specified, it is possible to return +results for a comma separated list of channels.</dd> +<dt>auth_key:   (string) (optional) </dt> +<dd>Specifies the auth_key to return PAM attributes for. +If only a single channel is specified, it is possible to return +results for a comma separated list of auth_keys.</dd> +<dt>callback:   (function) (optional) </dt> +<dd>A callback method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado</dd> +<dt>error:      (function) (optional)</dt> +<dd>An error method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd><p class="first">Returns a dict in sync mode i.e. when callback argument is not given +The dict returned contains values with keys ‘message’ and ‘payload’</p> +<p>Sample Response +{</p> +<blockquote> +<div><p>“message”:”Success”, +“payload”:{</p> +<blockquote> +<div><dl class="docutils"> +<dt>“channels”:{</dt> +<dd><dl class="first docutils"> +<dt>“my_channel”:{</dt> +<dd>“auths”:{“my_ro_authkey”:{“r”:1,”w”:0}, +“my_rw_authkey”:{“r”:0,”w”:1}, +“my_admin_authkey”:{“r”:1,”w”:1}</dd> +</dl> +<p class="last">}</p> +</dd> +</dl> +<p>}</p> +</div></blockquote> +<p>},</p> +</div></blockquote> +<p class="last">}</p> +</dd> +</dl> +<p>Usage:</p> +<blockquote> +<div>pubnub.audit (‘my_channel’);  # Sync Mode</div></blockquote> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.Pubnub.decrypt"> +<tt class="descname">decrypt</tt><big>(</big><em>message</em><big>)</big><a class="headerlink" href="#Pubnub.Pubnub.decrypt" title="Permalink to this definition">¶</a></dt> +<dd><p>Method for decrypting data.</p> +<p>This method takes ciphertext as input and returns decrypted data. +This need not be called directly as enncryption/decryption is +taken care of transparently by Pubnub class if cipher key is  +provided at time of initializing pubnub object</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd>message: Message to be decrypted.</dd> +<dt>Returns:</dt> +<dd>Returns decrypted message if cipher key is set</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.Pubnub.encrypt"> +<tt class="descname">encrypt</tt><big>(</big><em>message</em><big>)</big><a class="headerlink" href="#Pubnub.Pubnub.encrypt" title="Permalink to this definition">¶</a></dt> +<dd><p>Method for encrypting data.</p> +<p>This method takes plaintext as input and returns encrypted data. +This need not be called directly as enncryption/decryption is +taken care of transparently by Pubnub class if cipher key is  +provided at time of initializing pubnub object</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd>message: Message to be encrypted.</dd> +<dt>Returns:</dt> +<dd>Returns encrypted message if cipher key is set</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.Pubnub.grant"> +<tt class="descname">grant</tt><big>(</big><em>channel=None</em>, <em>auth_key=False</em>, <em>read=True</em>, <em>write=True</em>, <em>ttl=5</em>, <em>callback=None</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.Pubnub.grant" title="Permalink to this definition">¶</a></dt> +<dd><p>Method for granting permissions.</p> +<p>This function establishes subscribe and/or write permissions for +PubNub Access Manager (PAM) by setting the read or write attribute +to true. A grant with read or write set to false (or not included) +will revoke any previous grants with read or write set to true.</p> +<dl class="docutils"> +<dt>Permissions can be applied to any one of three levels:</dt> +<dd><ol class="first last arabic simple"> +<li>Application level privileges are based on subscribe_key applying to all associated channels.</li> +<li>Channel level privileges are based on a combination of subscribe_key and channel name.</li> +<li>User level privileges are based on the combination of subscribe_key, channel and auth_key.</li> +</ol> +</dd> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string) (optional)</dt> +<dd>Specifies channel name to grant permissions to. +If channel is not specified, the grant applies to all +channels associated with the subscribe_key. If auth_key +is not specified, it is possible to grant permissions to +multiple channels simultaneously by specifying the channels +as a comma separated list.</dd> +<dt>auth_key:   (string) (optional) </dt> +<dd>Specifies auth_key to grant permissions to. +It is possible to specify multiple auth_keys as comma +separated list in combination with a single channel name. +If auth_key is provided as the special-case value “null”  +(or included in a comma-separated list, eg. “null,null,abc”),  +a new auth_key will be generated and returned for each “null” value.</dd> +<dt>read:       (boolean) (default: True)</dt> +<dd>Read permissions are granted by setting to True. +Read permissions are removed by setting to False.</dd> +<dt>write:      (boolean) (default: True)</dt> +<dd>Write permissions are granted by setting to true. +Write permissions are removed by setting to false.</dd> +<dt>ttl:        (int) (default: 1440 i.e 24 hrs)</dt> +<dd>Time in minutes for which granted permissions are valid. +Max is 525600 , Min is 1. +Setting ttl to 0 will apply the grant indefinitely.</dd> +<dt>callback:   (function) (optional)</dt> +<dd>A callback method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado</dd> +<dt>error:      (function) (optional)</dt> +<dd>An error method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd><p class="first">Returns a dict in sync mode i.e. when callback argument is not given +The dict returned contains values with keys ‘message’ and ‘payload’</p> +<p>Sample Response: +{</p> +<blockquote> +<div><p>“message”:”Success”, +“payload”:{</p> +<blockquote> +<div><p>“ttl”:5, +“auths”:{</p> +<blockquote> +<div>“my_ro_authkey”:{“r”:1,”w”:0}</div></blockquote> +<p>}, +“subscribe_key”:”my_subkey”, +“level”:”user”, +“channel”:”my_channel”</p> +</div></blockquote> +<p>}</p> +</div></blockquote> +<p class="last">}</p> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.Pubnub.here_now"> +<tt class="descname">here_now</tt><big>(</big><em>channel</em>, <em>callback=None</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.Pubnub.here_now" title="Permalink to this definition">¶</a></dt> +<dd><p>Get here now data.</p> +<p>You can obtain information about the current state of a channel including +a list of unique user-ids currently subscribed to the channel and the total +occupancy count of the channel by calling the here_now() function in your  +application.</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string) (optional)</dt> +<dd>Specifies the channel name to return occupancy results. +If channel is not provided, here_now will return data for all channels.</dd> +<dt>callback:   (optional)</dt> +<dd>A callback method should be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +<dt>error:      (optional)</dt> +<dd>Optional variable. An error method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd><p class="first">Sync  Mode: list +Async Mode: None</p> +<p>Response Format:</p> +<p>The here_now() method returns a list of uuid s currently subscribed to the channel.</p> +<p>uuids:[“String”,”String”, ... ,”String”] - List of UUIDs currently subscribed to the channel.</p> +<p>occupancy: Number - Total current occupancy of the channel.</p> +<p>Example Response: +{</p> +<blockquote> +<div><p>occupancy: 4, +uuids: [</p> +<blockquote> +<div>‘123123234t234f34fq3dq’, +‘143r34f34t34fq34q34q3’, +‘23f34d3f4rq34r34rq23q’, +‘w34tcw45t45tcw435tww3’,</div></blockquote> +<p>]</p> +</div></blockquote> +<p class="last">}</p> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.Pubnub.history"> +<tt class="descname">history</tt><big>(</big><em>channel</em>, <em>count=100</em>, <em>reverse=False</em>, <em>start=None</em>, <em>end=None</em>, <em>callback=None</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.Pubnub.history" title="Permalink to this definition">¶</a></dt> +<dd><p>This method fetches historical messages of a channel.</p> +<p>PubNub Storage/Playback Service provides real-time access to an unlimited +history for all messages published to PubNub. Stored messages are replicated +across multiple availability zones in several geographical data center +locations. Stored messages can be encrypted with AES-256 message encryption +ensuring that they are not readable while stored on PubNub’s network.</p> +<p>It is possible to control how messages are returned and in what order, +for example you can:</p> +<blockquote> +<div><p>Return messages in the order newest to oldest (default behavior).</p> +<p>Return messages in the order oldest to newest by setting reverse to true.</p> +<p>Page through results by providing a start or end time token.</p> +<p>Retrieve a “slice” of the time line by providing both a start and end time token.</p> +<p>Limit the number of messages to a specific quantity using the count parameter.</p> +</div></blockquote> +<dl class="docutils"> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string)</dt> +<dd>Specifies channel to return history messages from</dd> +<dt>count:      (int) (default: 100)</dt> +<dd>Specifies the number of historical messages to return</dd> +<dt>callback:   (optional)</dt> +<dd>A callback method should be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +<dt>error:      (optional)</dt> +<dd>An error method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd><p class="first">Returns a list in sync mode i.e. when callback argument is not given</p> +<dl class="last docutils"> +<dt>Sample Response:</dt> +<dd>[[“Pub1”,”Pub2”,”Pub3”,”Pub4”,”Pub5”],13406746729185766,13406746845892666]</dd> +</dl> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.Pubnub.presence"> +<tt class="descname">presence</tt><big>(</big><em>channel</em>, <em>callback</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.Pubnub.presence" title="Permalink to this definition">¶</a></dt> +<dd><p>Subscribe to presence data on a channel.</p> +<blockquote> +<div>Only works in async mode</div></blockquote> +<dl class="docutils"> +<dt>Args:</dt> +<dd><p class="first">channel: Channel name ( string ) on which to publish message +callback: A callback method should be passed to the method.</p> +<blockquote> +<div>If set, the api works in async mode.  +Required argument when working with twisted or tornado .</div></blockquote> +<dl class="last docutils"> +<dt>error: Optional variable. An error method can be passed to the method.</dt> +<dd>If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd>None</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.Pubnub.publish"> +<tt class="descname">publish</tt><big>(</big><em>channel</em>, <em>message</em>, <em>callback=None</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.Pubnub.publish" title="Permalink to this definition">¶</a></dt> +<dd><p>Publishes data on a channel.</p> +<p>The publish() method is used to send a message to all subscribers of a channel. +To publish a message you must first specify a valid publish_key at initialization. +A successfully published message is replicated across the PubNub Real-Time Network +and sent simultaneously to all subscribed clients on a channel.</p> +<blockquote> +<div>Messages in transit can be secured from potential eavesdroppers with SSL/TLS by</div></blockquote> +<p>setting ssl to True during initialization.</p> +<p>Published messages can also be encrypted with AES-256 simply by specifying a cipher_key +during initialization.</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string)</dt> +<dd>Specifies channel name to publish messages to.</dd> +<dt>message:    (string/int/double/dict/list)</dt> +<dd>Message to be published</dd> +<dt>callback:   (optional)</dt> +<dd>A callback method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado</dd> +<dt>error:      (optional)</dt> +<dd>An error method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd><p class="first">Sync Mode  : list +Async Mode : None</p> +<p>The function returns the following formatted response:</p> +<blockquote> +<div>[ Number, “Status”, “Time Token”]</div></blockquote> +<p>The output below demonstrates the response to a successful call:</p> +<blockquote class="last"> +<div>[1,”Sent”,”13769558699541401”]</div></blockquote> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.Pubnub.revoke"> +<tt class="descname">revoke</tt><big>(</big><em>channel=None</em>, <em>auth_key=None</em>, <em>ttl=1</em>, <em>callback=None</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.Pubnub.revoke" title="Permalink to this definition">¶</a></dt> +<dd><p>Method for revoking permissions.</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string) (optional)</dt> +<dd>Specifies channel name to revoke permissions to. +If channel is not specified, the revoke applies to all +channels associated with the subscribe_key. If auth_key +is not specified, it is possible to grant permissions to +multiple channels simultaneously by specifying the channels +as a comma separated list.</dd> +<dt>auth_key:   (string) (optional) </dt> +<dd>Specifies auth_key to revoke permissions to. +It is possible to specify multiple auth_keys as comma +separated list in combination with a single channel name. +If auth_key is provided as the special-case value “null”  +(or included in a comma-separated list, eg. “null,null,abc”),  +a new auth_key will be generated and returned for each “null” value.</dd> +<dt>ttl:        (int) (default: 1440 i.e 24 hrs)</dt> +<dd>Time in minutes for which granted permissions are valid. +Max is 525600 , Min is 1. +Setting ttl to 0 will apply the grant indefinitely.</dd> +<dt>callback:   (function) (optional)</dt> +<dd>A callback method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado</dd> +<dt>error:      (function) (optional)</dt> +<dd>An error method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd><p class="first">Returns a dict in sync mode i.e. when callback argument is not given +The dict returned contains values with keys ‘message’ and ‘payload’</p> +<p>Sample Response: +{</p> +<blockquote> +<div><p>“message”:”Success”, +“payload”:{</p> +<blockquote> +<div><p>“ttl”:5, +“auths”:{</p> +<blockquote> +<div>“my_authkey”:{“r”:0,”w”:0}</div></blockquote> +<p>}, +“subscribe_key”:”my_subkey”, +“level”:”user”, +“channel”:”my_channel”</p> +</div></blockquote> +<p>}</p> +</div></blockquote> +<p class="last">}</p> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.Pubnub.subscribe"> +<tt class="descname">subscribe</tt><big>(</big><em>channels</em>, <em>callback</em>, <em>error=None</em>, <em>connect=None</em>, <em>disconnect=None</em>, <em>reconnect=None</em>, <em>sync=False</em><big>)</big><a class="headerlink" href="#Pubnub.Pubnub.subscribe" title="Permalink to this definition">¶</a></dt> +<dd><p>Subscribe to data on a channel.</p> +<p>This function causes the client to create an open TCP socket to the +PubNub Real-Time Network and begin listening for messages on a specified channel. +To subscribe to a channel the client must send the appropriate subscribe_key at +initialization.</p> +<p>Only works in async mode</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string/list)</dt> +<dd>Specifies the channel to subscribe to. It is possible to specify +multiple channels as a comma separated list or andarray.</dd> +<dt>callback:   (function)</dt> +<dd>This callback is called on receiving a message from the channel.</dd> +<dt>error:      (function) (optional)</dt> +<dd>This callback is called on an error event</dd> +<dt>connect:    (function) (optional)</dt> +<dd>This callback is called on a successful connection to the PubNub cloud</dd> +<dt>disconnect: (function) (optional)</dt> +<dd>This callback is called on client disconnect from the PubNub cloud</dd> +<dt>reconnect:  (function) (optional)</dt> +<dd>This callback is called on successfully re-connecting to the PubNub cloud</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd>None</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.Pubnub.time"> +<tt class="descname">time</tt><big>(</big><em>callback=None</em><big>)</big><a class="headerlink" href="#Pubnub.Pubnub.time" title="Permalink to this definition">¶</a></dt> +<dd><p>This function will return a 17 digit precision Unix epoch.</p> +<p>Args:</p> +<blockquote> +<div><dl class="docutils"> +<dt>callback:   (optional)</dt> +<dd>A callback method should be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</div></blockquote> +<dl class="docutils"> +<dt>Returns:</dt> +<dd><p class="first">Returns a 17 digit number in sync mode i.e. when callback argument is not given</p> +<dl class="last docutils"> +<dt>Sample:</dt> +<dd>13769501243685161</dd> +</dl> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.Pubnub.unsubscribe"> +<tt class="descname">unsubscribe</tt><big>(</big><em>channel</em><big>)</big><a class="headerlink" href="#Pubnub.Pubnub.unsubscribe" title="Permalink to this definition">¶</a></dt> +<dd><dl class="docutils"> +<dt>Subscribe to presence data on a channel.</dt> +<dd>Only works in async mode</dd> +<dt>Args:</dt> +<dd><p class="first">channel: Channel name ( string ) on which to publish message +message: Message to be published ( String / int / double / dict / list ). +callback: A callback method should be passed to the method.</p> +<blockquote> +<div>If set, the api works in async mode.  +Required argument when working with twisted or tornado .</div></blockquote> +<dl class="last docutils"> +<dt>error: Optional variable. An error method can be passed to the method.</dt> +<dd>If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd>Returns a list in sync mode i.e. when callback argument is not given</dd> +</dl> +</dd></dl> + +</dd></dl> + +</div> +<div class="section" id="pubnubtwisted"> +<h2>PubnubTwisted<a class="headerlink" href="#pubnubtwisted" title="Permalink to this headline">¶</a></h2> +<dl class="class"> +<dt id="Pubnub.PubnubTwisted"> +<em class="property">class </em><tt class="descclassname">Pubnub.</tt><tt class="descname">PubnubTwisted</tt><big>(</big><em>publish_key</em>, <em>subscribe_key</em>, <em>secret_key=None</em>, <em>cipher_key=None</em>, <em>auth_key=None</em>, <em>ssl_on=False</em>, <em>origin='pubsub.pubnub.com'</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTwisted" title="Permalink to this definition">¶</a></dt> +<dd><dl class="method"> +<dt id="Pubnub.PubnubTwisted.audit"> +<tt class="descname">audit</tt><big>(</big><em>channel=None</em>, <em>auth_key=None</em>, <em>callback=None</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTwisted.audit" title="Permalink to this definition">¶</a></dt> +<dd><p>Method for fetching permissions from pubnub servers.</p> +<p>This method provides a mechanism to reveal existing PubNub Access Manager attributes +for any combination of subscribe_key, channel and auth_key.</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string) (optional)</dt> +<dd>Specifies channel name to return PAM  +attributes optionally in combination with auth_key. +If channel is not specified, results for all channels +associated with subscribe_key are returned. +If auth_key is not specified, it is possible to return +results for a comma separated list of channels.</dd> +<dt>auth_key:   (string) (optional) </dt> +<dd>Specifies the auth_key to return PAM attributes for. +If only a single channel is specified, it is possible to return +results for a comma separated list of auth_keys.</dd> +<dt>callback:   (function) (optional) </dt> +<dd>A callback method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado</dd> +<dt>error:      (function) (optional)</dt> +<dd>An error method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd><p class="first">Returns a dict in sync mode i.e. when callback argument is not given +The dict returned contains values with keys ‘message’ and ‘payload’</p> +<p>Sample Response +{</p> +<blockquote> +<div><p>“message”:”Success”, +“payload”:{</p> +<blockquote> +<div><dl class="docutils"> +<dt>“channels”:{</dt> +<dd><dl class="first docutils"> +<dt>“my_channel”:{</dt> +<dd>“auths”:{“my_ro_authkey”:{“r”:1,”w”:0}, +“my_rw_authkey”:{“r”:0,”w”:1}, +“my_admin_authkey”:{“r”:1,”w”:1}</dd> +</dl> +<p class="last">}</p> +</dd> +</dl> +<p>}</p> +</div></blockquote> +<p>},</p> +</div></blockquote> +<p class="last">}</p> +</dd> +</dl> +<p>Usage:</p> +<blockquote> +<div>pubnub.audit (‘my_channel’);  # Sync Mode</div></blockquote> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTwisted.decrypt"> +<tt class="descname">decrypt</tt><big>(</big><em>message</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTwisted.decrypt" title="Permalink to this definition">¶</a></dt> +<dd><p>Method for decrypting data.</p> +<p>This method takes ciphertext as input and returns decrypted data. +This need not be called directly as enncryption/decryption is +taken care of transparently by Pubnub class if cipher key is  +provided at time of initializing pubnub object</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd>message: Message to be decrypted.</dd> +<dt>Returns:</dt> +<dd>Returns decrypted message if cipher key is set</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTwisted.encrypt"> +<tt class="descname">encrypt</tt><big>(</big><em>message</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTwisted.encrypt" title="Permalink to this definition">¶</a></dt> +<dd><p>Method for encrypting data.</p> +<p>This method takes plaintext as input and returns encrypted data. +This need not be called directly as enncryption/decryption is +taken care of transparently by Pubnub class if cipher key is  +provided at time of initializing pubnub object</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd>message: Message to be encrypted.</dd> +<dt>Returns:</dt> +<dd>Returns encrypted message if cipher key is set</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTwisted.grant"> +<tt class="descname">grant</tt><big>(</big><em>channel=None</em>, <em>auth_key=False</em>, <em>read=True</em>, <em>write=True</em>, <em>ttl=5</em>, <em>callback=None</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTwisted.grant" title="Permalink to this definition">¶</a></dt> +<dd><p>Method for granting permissions.</p> +<p>This function establishes subscribe and/or write permissions for +PubNub Access Manager (PAM) by setting the read or write attribute +to true. A grant with read or write set to false (or not included) +will revoke any previous grants with read or write set to true.</p> +<dl class="docutils"> +<dt>Permissions can be applied to any one of three levels:</dt> +<dd><ol class="first last arabic simple"> +<li>Application level privileges are based on subscribe_key applying to all associated channels.</li> +<li>Channel level privileges are based on a combination of subscribe_key and channel name.</li> +<li>User level privileges are based on the combination of subscribe_key, channel and auth_key.</li> +</ol> +</dd> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string) (optional)</dt> +<dd>Specifies channel name to grant permissions to. +If channel is not specified, the grant applies to all +channels associated with the subscribe_key. If auth_key +is not specified, it is possible to grant permissions to +multiple channels simultaneously by specifying the channels +as a comma separated list.</dd> +<dt>auth_key:   (string) (optional) </dt> +<dd>Specifies auth_key to grant permissions to. +It is possible to specify multiple auth_keys as comma +separated list in combination with a single channel name. +If auth_key is provided as the special-case value “null”  +(or included in a comma-separated list, eg. “null,null,abc”),  +a new auth_key will be generated and returned for each “null” value.</dd> +<dt>read:       (boolean) (default: True)</dt> +<dd>Read permissions are granted by setting to True. +Read permissions are removed by setting to False.</dd> +<dt>write:      (boolean) (default: True)</dt> +<dd>Write permissions are granted by setting to true. +Write permissions are removed by setting to false.</dd> +<dt>ttl:        (int) (default: 1440 i.e 24 hrs)</dt> +<dd>Time in minutes for which granted permissions are valid. +Max is 525600 , Min is 1. +Setting ttl to 0 will apply the grant indefinitely.</dd> +<dt>callback:   (function) (optional)</dt> +<dd>A callback method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado</dd> +<dt>error:      (function) (optional)</dt> +<dd>An error method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd><p class="first">Returns a dict in sync mode i.e. when callback argument is not given +The dict returned contains values with keys ‘message’ and ‘payload’</p> +<p>Sample Response: +{</p> +<blockquote> +<div><p>“message”:”Success”, +“payload”:{</p> +<blockquote> +<div><p>“ttl”:5, +“auths”:{</p> +<blockquote> +<div>“my_ro_authkey”:{“r”:1,”w”:0}</div></blockquote> +<p>}, +“subscribe_key”:”my_subkey”, +“level”:”user”, +“channel”:”my_channel”</p> +</div></blockquote> +<p>}</p> +</div></blockquote> +<p class="last">}</p> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTwisted.here_now"> +<tt class="descname">here_now</tt><big>(</big><em>channel</em>, <em>callback=None</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTwisted.here_now" title="Permalink to this definition">¶</a></dt> +<dd><p>Get here now data.</p> +<p>You can obtain information about the current state of a channel including +a list of unique user-ids currently subscribed to the channel and the total +occupancy count of the channel by calling the here_now() function in your  +application.</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string) (optional)</dt> +<dd>Specifies the channel name to return occupancy results. +If channel is not provided, here_now will return data for all channels.</dd> +<dt>callback:   (optional)</dt> +<dd>A callback method should be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +<dt>error:      (optional)</dt> +<dd>Optional variable. An error method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd><p class="first">Sync  Mode: list +Async Mode: None</p> +<p>Response Format:</p> +<p>The here_now() method returns a list of uuid s currently subscribed to the channel.</p> +<p>uuids:[“String”,”String”, ... ,”String”] - List of UUIDs currently subscribed to the channel.</p> +<p>occupancy: Number - Total current occupancy of the channel.</p> +<p>Example Response: +{</p> +<blockquote> +<div><p>occupancy: 4, +uuids: [</p> +<blockquote> +<div>‘123123234t234f34fq3dq’, +‘143r34f34t34fq34q34q3’, +‘23f34d3f4rq34r34rq23q’, +‘w34tcw45t45tcw435tww3’,</div></blockquote> +<p>]</p> +</div></blockquote> +<p class="last">}</p> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTwisted.history"> +<tt class="descname">history</tt><big>(</big><em>channel</em>, <em>count=100</em>, <em>reverse=False</em>, <em>start=None</em>, <em>end=None</em>, <em>callback=None</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTwisted.history" title="Permalink to this definition">¶</a></dt> +<dd><p>This method fetches historical messages of a channel.</p> +<p>PubNub Storage/Playback Service provides real-time access to an unlimited +history for all messages published to PubNub. Stored messages are replicated +across multiple availability zones in several geographical data center +locations. Stored messages can be encrypted with AES-256 message encryption +ensuring that they are not readable while stored on PubNub’s network.</p> +<p>It is possible to control how messages are returned and in what order, +for example you can:</p> +<blockquote> +<div><p>Return messages in the order newest to oldest (default behavior).</p> +<p>Return messages in the order oldest to newest by setting reverse to true.</p> +<p>Page through results by providing a start or end time token.</p> +<p>Retrieve a “slice” of the time line by providing both a start and end time token.</p> +<p>Limit the number of messages to a specific quantity using the count parameter.</p> +</div></blockquote> +<dl class="docutils"> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string)</dt> +<dd>Specifies channel to return history messages from</dd> +<dt>count:      (int) (default: 100)</dt> +<dd>Specifies the number of historical messages to return</dd> +<dt>callback:   (optional)</dt> +<dd>A callback method should be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +<dt>error:      (optional)</dt> +<dd>An error method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd><p class="first">Returns a list in sync mode i.e. when callback argument is not given</p> +<dl class="last docutils"> +<dt>Sample Response:</dt> +<dd>[[“Pub1”,”Pub2”,”Pub3”,”Pub4”,”Pub5”],13406746729185766,13406746845892666]</dd> +</dl> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTwisted.presence"> +<tt class="descname">presence</tt><big>(</big><em>channel</em>, <em>callback</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTwisted.presence" title="Permalink to this definition">¶</a></dt> +<dd><p>Subscribe to presence data on a channel.</p> +<blockquote> +<div>Only works in async mode</div></blockquote> +<dl class="docutils"> +<dt>Args:</dt> +<dd><p class="first">channel: Channel name ( string ) on which to publish message +callback: A callback method should be passed to the method.</p> +<blockquote> +<div>If set, the api works in async mode.  +Required argument when working with twisted or tornado .</div></blockquote> +<dl class="last docutils"> +<dt>error: Optional variable. An error method can be passed to the method.</dt> +<dd>If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd>None</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTwisted.publish"> +<tt class="descname">publish</tt><big>(</big><em>channel</em>, <em>message</em>, <em>callback=None</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTwisted.publish" title="Permalink to this definition">¶</a></dt> +<dd><p>Publishes data on a channel.</p> +<p>The publish() method is used to send a message to all subscribers of a channel. +To publish a message you must first specify a valid publish_key at initialization. +A successfully published message is replicated across the PubNub Real-Time Network +and sent simultaneously to all subscribed clients on a channel.</p> +<blockquote> +<div>Messages in transit can be secured from potential eavesdroppers with SSL/TLS by</div></blockquote> +<p>setting ssl to True during initialization.</p> +<p>Published messages can also be encrypted with AES-256 simply by specifying a cipher_key +during initialization.</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string)</dt> +<dd>Specifies channel name to publish messages to.</dd> +<dt>message:    (string/int/double/dict/list)</dt> +<dd>Message to be published</dd> +<dt>callback:   (optional)</dt> +<dd>A callback method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado</dd> +<dt>error:      (optional)</dt> +<dd>An error method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd><p class="first">Sync Mode  : list +Async Mode : None</p> +<p>The function returns the following formatted response:</p> +<blockquote> +<div>[ Number, “Status”, “Time Token”]</div></blockquote> +<p>The output below demonstrates the response to a successful call:</p> +<blockquote class="last"> +<div>[1,”Sent”,”13769558699541401”]</div></blockquote> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTwisted.revoke"> +<tt class="descname">revoke</tt><big>(</big><em>channel=None</em>, <em>auth_key=None</em>, <em>ttl=1</em>, <em>callback=None</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTwisted.revoke" title="Permalink to this definition">¶</a></dt> +<dd><p>Method for revoking permissions.</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string) (optional)</dt> +<dd>Specifies channel name to revoke permissions to. +If channel is not specified, the revoke applies to all +channels associated with the subscribe_key. If auth_key +is not specified, it is possible to grant permissions to +multiple channels simultaneously by specifying the channels +as a comma separated list.</dd> +<dt>auth_key:   (string) (optional) </dt> +<dd>Specifies auth_key to revoke permissions to. +It is possible to specify multiple auth_keys as comma +separated list in combination with a single channel name. +If auth_key is provided as the special-case value “null”  +(or included in a comma-separated list, eg. “null,null,abc”),  +a new auth_key will be generated and returned for each “null” value.</dd> +<dt>ttl:        (int) (default: 1440 i.e 24 hrs)</dt> +<dd>Time in minutes for which granted permissions are valid. +Max is 525600 , Min is 1. +Setting ttl to 0 will apply the grant indefinitely.</dd> +<dt>callback:   (function) (optional)</dt> +<dd>A callback method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado</dd> +<dt>error:      (function) (optional)</dt> +<dd>An error method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd><p class="first">Returns a dict in sync mode i.e. when callback argument is not given +The dict returned contains values with keys ‘message’ and ‘payload’</p> +<p>Sample Response: +{</p> +<blockquote> +<div><p>“message”:”Success”, +“payload”:{</p> +<blockquote> +<div><p>“ttl”:5, +“auths”:{</p> +<blockquote> +<div>“my_authkey”:{“r”:0,”w”:0}</div></blockquote> +<p>}, +“subscribe_key”:”my_subkey”, +“level”:”user”, +“channel”:”my_channel”</p> +</div></blockquote> +<p>}</p> +</div></blockquote> +<p class="last">}</p> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTwisted.subscribe"> +<tt class="descname">subscribe</tt><big>(</big><em>channels</em>, <em>callback</em>, <em>error=None</em>, <em>connect=None</em>, <em>disconnect=None</em>, <em>reconnect=None</em>, <em>sync=False</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTwisted.subscribe" title="Permalink to this definition">¶</a></dt> +<dd><p>Subscribe to data on a channel.</p> +<p>This function causes the client to create an open TCP socket to the +PubNub Real-Time Network and begin listening for messages on a specified channel. +To subscribe to a channel the client must send the appropriate subscribe_key at +initialization.</p> +<p>Only works in async mode</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string/list)</dt> +<dd>Specifies the channel to subscribe to. It is possible to specify +multiple channels as a comma separated list or andarray.</dd> +<dt>callback:   (function)</dt> +<dd>This callback is called on receiving a message from the channel.</dd> +<dt>error:      (function) (optional)</dt> +<dd>This callback is called on an error event</dd> +<dt>connect:    (function) (optional)</dt> +<dd>This callback is called on a successful connection to the PubNub cloud</dd> +<dt>disconnect: (function) (optional)</dt> +<dd>This callback is called on client disconnect from the PubNub cloud</dd> +<dt>reconnect:  (function) (optional)</dt> +<dd>This callback is called on successfully re-connecting to the PubNub cloud</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd>None</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTwisted.time"> +<tt class="descname">time</tt><big>(</big><em>callback=None</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTwisted.time" title="Permalink to this definition">¶</a></dt> +<dd><p>This function will return a 17 digit precision Unix epoch.</p> +<p>Args:</p> +<blockquote> +<div><dl class="docutils"> +<dt>callback:   (optional)</dt> +<dd>A callback method should be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</div></blockquote> +<dl class="docutils"> +<dt>Returns:</dt> +<dd><p class="first">Returns a 17 digit number in sync mode i.e. when callback argument is not given</p> +<dl class="last docutils"> +<dt>Sample:</dt> +<dd>13769501243685161</dd> +</dl> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTwisted.unsubscribe"> +<tt class="descname">unsubscribe</tt><big>(</big><em>channel</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTwisted.unsubscribe" title="Permalink to this definition">¶</a></dt> +<dd><dl class="docutils"> +<dt>Subscribe to presence data on a channel.</dt> +<dd>Only works in async mode</dd> +<dt>Args:</dt> +<dd><p class="first">channel: Channel name ( string ) on which to publish message +message: Message to be published ( String / int / double / dict / list ). +callback: A callback method should be passed to the method.</p> +<blockquote> +<div>If set, the api works in async mode.  +Required argument when working with twisted or tornado .</div></blockquote> +<dl class="last docutils"> +<dt>error: Optional variable. An error method can be passed to the method.</dt> +<dd>If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd>Returns a list in sync mode i.e. when callback argument is not given</dd> +</dl> +</dd></dl> + +</dd></dl> + +</div> +<div class="section" id="pubnubtornado"> +<h2>PubnubTornado<a class="headerlink" href="#pubnubtornado" title="Permalink to this headline">¶</a></h2> +<dl class="class"> +<dt id="Pubnub.PubnubTornado"> +<em class="property">class </em><tt class="descclassname">Pubnub.</tt><tt class="descname">PubnubTornado</tt><big>(</big><em>publish_key</em>, <em>subscribe_key</em>, <em>secret_key=False</em>, <em>cipher_key=False</em>, <em>auth_key=False</em>, <em>ssl_on=False</em>, <em>origin='pubsub.pubnub.com'</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTornado" title="Permalink to this definition">¶</a></dt> +<dd><dl class="method"> +<dt id="Pubnub.PubnubTornado.audit"> +<tt class="descname">audit</tt><big>(</big><em>channel=None</em>, <em>auth_key=None</em>, <em>callback=None</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTornado.audit" title="Permalink to this definition">¶</a></dt> +<dd><p>Method for fetching permissions from pubnub servers.</p> +<p>This method provides a mechanism to reveal existing PubNub Access Manager attributes +for any combination of subscribe_key, channel and auth_key.</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string) (optional)</dt> +<dd>Specifies channel name to return PAM  +attributes optionally in combination with auth_key. +If channel is not specified, results for all channels +associated with subscribe_key are returned. +If auth_key is not specified, it is possible to return +results for a comma separated list of channels.</dd> +<dt>auth_key:   (string) (optional) </dt> +<dd>Specifies the auth_key to return PAM attributes for. +If only a single channel is specified, it is possible to return +results for a comma separated list of auth_keys.</dd> +<dt>callback:   (function) (optional) </dt> +<dd>A callback method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado</dd> +<dt>error:      (function) (optional)</dt> +<dd>An error method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd><p class="first">Returns a dict in sync mode i.e. when callback argument is not given +The dict returned contains values with keys ‘message’ and ‘payload’</p> +<p>Sample Response +{</p> +<blockquote> +<div><p>“message”:”Success”, +“payload”:{</p> +<blockquote> +<div><dl class="docutils"> +<dt>“channels”:{</dt> +<dd><dl class="first docutils"> +<dt>“my_channel”:{</dt> +<dd>“auths”:{“my_ro_authkey”:{“r”:1,”w”:0}, +“my_rw_authkey”:{“r”:0,”w”:1}, +“my_admin_authkey”:{“r”:1,”w”:1}</dd> +</dl> +<p class="last">}</p> +</dd> +</dl> +<p>}</p> +</div></blockquote> +<p>},</p> +</div></blockquote> +<p class="last">}</p> +</dd> +</dl> +<p>Usage:</p> +<blockquote> +<div>pubnub.audit (‘my_channel’);  # Sync Mode</div></blockquote> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTornado.decrypt"> +<tt class="descname">decrypt</tt><big>(</big><em>message</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTornado.decrypt" title="Permalink to this definition">¶</a></dt> +<dd><p>Method for decrypting data.</p> +<p>This method takes ciphertext as input and returns decrypted data. +This need not be called directly as enncryption/decryption is +taken care of transparently by Pubnub class if cipher key is  +provided at time of initializing pubnub object</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd>message: Message to be decrypted.</dd> +<dt>Returns:</dt> +<dd>Returns decrypted message if cipher key is set</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTornado.encrypt"> +<tt class="descname">encrypt</tt><big>(</big><em>message</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTornado.encrypt" title="Permalink to this definition">¶</a></dt> +<dd><p>Method for encrypting data.</p> +<p>This method takes plaintext as input and returns encrypted data. +This need not be called directly as enncryption/decryption is +taken care of transparently by Pubnub class if cipher key is  +provided at time of initializing pubnub object</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd>message: Message to be encrypted.</dd> +<dt>Returns:</dt> +<dd>Returns encrypted message if cipher key is set</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTornado.grant"> +<tt class="descname">grant</tt><big>(</big><em>channel=None</em>, <em>auth_key=False</em>, <em>read=True</em>, <em>write=True</em>, <em>ttl=5</em>, <em>callback=None</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTornado.grant" title="Permalink to this definition">¶</a></dt> +<dd><p>Method for granting permissions.</p> +<p>This function establishes subscribe and/or write permissions for +PubNub Access Manager (PAM) by setting the read or write attribute +to true. A grant with read or write set to false (or not included) +will revoke any previous grants with read or write set to true.</p> +<dl class="docutils"> +<dt>Permissions can be applied to any one of three levels:</dt> +<dd><ol class="first last arabic simple"> +<li>Application level privileges are based on subscribe_key applying to all associated channels.</li> +<li>Channel level privileges are based on a combination of subscribe_key and channel name.</li> +<li>User level privileges are based on the combination of subscribe_key, channel and auth_key.</li> +</ol> +</dd> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string) (optional)</dt> +<dd>Specifies channel name to grant permissions to. +If channel is not specified, the grant applies to all +channels associated with the subscribe_key. If auth_key +is not specified, it is possible to grant permissions to +multiple channels simultaneously by specifying the channels +as a comma separated list.</dd> +<dt>auth_key:   (string) (optional) </dt> +<dd>Specifies auth_key to grant permissions to. +It is possible to specify multiple auth_keys as comma +separated list in combination with a single channel name. +If auth_key is provided as the special-case value “null”  +(or included in a comma-separated list, eg. “null,null,abc”),  +a new auth_key will be generated and returned for each “null” value.</dd> +<dt>read:       (boolean) (default: True)</dt> +<dd>Read permissions are granted by setting to True. +Read permissions are removed by setting to False.</dd> +<dt>write:      (boolean) (default: True)</dt> +<dd>Write permissions are granted by setting to true. +Write permissions are removed by setting to false.</dd> +<dt>ttl:        (int) (default: 1440 i.e 24 hrs)</dt> +<dd>Time in minutes for which granted permissions are valid. +Max is 525600 , Min is 1. +Setting ttl to 0 will apply the grant indefinitely.</dd> +<dt>callback:   (function) (optional)</dt> +<dd>A callback method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado</dd> +<dt>error:      (function) (optional)</dt> +<dd>An error method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd><p class="first">Returns a dict in sync mode i.e. when callback argument is not given +The dict returned contains values with keys ‘message’ and ‘payload’</p> +<p>Sample Response: +{</p> +<blockquote> +<div><p>“message”:”Success”, +“payload”:{</p> +<blockquote> +<div><p>“ttl”:5, +“auths”:{</p> +<blockquote> +<div>“my_ro_authkey”:{“r”:1,”w”:0}</div></blockquote> +<p>}, +“subscribe_key”:”my_subkey”, +“level”:”user”, +“channel”:”my_channel”</p> +</div></blockquote> +<p>}</p> +</div></blockquote> +<p class="last">}</p> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTornado.here_now"> +<tt class="descname">here_now</tt><big>(</big><em>channel</em>, <em>callback=None</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTornado.here_now" title="Permalink to this definition">¶</a></dt> +<dd><p>Get here now data.</p> +<p>You can obtain information about the current state of a channel including +a list of unique user-ids currently subscribed to the channel and the total +occupancy count of the channel by calling the here_now() function in your  +application.</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string) (optional)</dt> +<dd>Specifies the channel name to return occupancy results. +If channel is not provided, here_now will return data for all channels.</dd> +<dt>callback:   (optional)</dt> +<dd>A callback method should be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +<dt>error:      (optional)</dt> +<dd>Optional variable. An error method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd><p class="first">Sync  Mode: list +Async Mode: None</p> +<p>Response Format:</p> +<p>The here_now() method returns a list of uuid s currently subscribed to the channel.</p> +<p>uuids:[“String”,”String”, ... ,”String”] - List of UUIDs currently subscribed to the channel.</p> +<p>occupancy: Number - Total current occupancy of the channel.</p> +<p>Example Response: +{</p> +<blockquote> +<div><p>occupancy: 4, +uuids: [</p> +<blockquote> +<div>‘123123234t234f34fq3dq’, +‘143r34f34t34fq34q34q3’, +‘23f34d3f4rq34r34rq23q’, +‘w34tcw45t45tcw435tww3’,</div></blockquote> +<p>]</p> +</div></blockquote> +<p class="last">}</p> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTornado.history"> +<tt class="descname">history</tt><big>(</big><em>channel</em>, <em>count=100</em>, <em>reverse=False</em>, <em>start=None</em>, <em>end=None</em>, <em>callback=None</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTornado.history" title="Permalink to this definition">¶</a></dt> +<dd><p>This method fetches historical messages of a channel.</p> +<p>PubNub Storage/Playback Service provides real-time access to an unlimited +history for all messages published to PubNub. Stored messages are replicated +across multiple availability zones in several geographical data center +locations. Stored messages can be encrypted with AES-256 message encryption +ensuring that they are not readable while stored on PubNub’s network.</p> +<p>It is possible to control how messages are returned and in what order, +for example you can:</p> +<blockquote> +<div><p>Return messages in the order newest to oldest (default behavior).</p> +<p>Return messages in the order oldest to newest by setting reverse to true.</p> +<p>Page through results by providing a start or end time token.</p> +<p>Retrieve a “slice” of the time line by providing both a start and end time token.</p> +<p>Limit the number of messages to a specific quantity using the count parameter.</p> +</div></blockquote> +<dl class="docutils"> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string)</dt> +<dd>Specifies channel to return history messages from</dd> +<dt>count:      (int) (default: 100)</dt> +<dd>Specifies the number of historical messages to return</dd> +<dt>callback:   (optional)</dt> +<dd>A callback method should be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +<dt>error:      (optional)</dt> +<dd>An error method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd><p class="first">Returns a list in sync mode i.e. when callback argument is not given</p> +<dl class="last docutils"> +<dt>Sample Response:</dt> +<dd>[[“Pub1”,”Pub2”,”Pub3”,”Pub4”,”Pub5”],13406746729185766,13406746845892666]</dd> +</dl> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTornado.presence"> +<tt class="descname">presence</tt><big>(</big><em>channel</em>, <em>callback</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTornado.presence" title="Permalink to this definition">¶</a></dt> +<dd><p>Subscribe to presence data on a channel.</p> +<blockquote> +<div>Only works in async mode</div></blockquote> +<dl class="docutils"> +<dt>Args:</dt> +<dd><p class="first">channel: Channel name ( string ) on which to publish message +callback: A callback method should be passed to the method.</p> +<blockquote> +<div>If set, the api works in async mode.  +Required argument when working with twisted or tornado .</div></blockquote> +<dl class="last docutils"> +<dt>error: Optional variable. An error method can be passed to the method.</dt> +<dd>If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd>None</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTornado.publish"> +<tt class="descname">publish</tt><big>(</big><em>channel</em>, <em>message</em>, <em>callback=None</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTornado.publish" title="Permalink to this definition">¶</a></dt> +<dd><p>Publishes data on a channel.</p> +<p>The publish() method is used to send a message to all subscribers of a channel. +To publish a message you must first specify a valid publish_key at initialization. +A successfully published message is replicated across the PubNub Real-Time Network +and sent simultaneously to all subscribed clients on a channel.</p> +<blockquote> +<div>Messages in transit can be secured from potential eavesdroppers with SSL/TLS by</div></blockquote> +<p>setting ssl to True during initialization.</p> +<p>Published messages can also be encrypted with AES-256 simply by specifying a cipher_key +during initialization.</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string)</dt> +<dd>Specifies channel name to publish messages to.</dd> +<dt>message:    (string/int/double/dict/list)</dt> +<dd>Message to be published</dd> +<dt>callback:   (optional)</dt> +<dd>A callback method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado</dd> +<dt>error:      (optional)</dt> +<dd>An error method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd><p class="first">Sync Mode  : list +Async Mode : None</p> +<p>The function returns the following formatted response:</p> +<blockquote> +<div>[ Number, “Status”, “Time Token”]</div></blockquote> +<p>The output below demonstrates the response to a successful call:</p> +<blockquote class="last"> +<div>[1,”Sent”,”13769558699541401”]</div></blockquote> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTornado.revoke"> +<tt class="descname">revoke</tt><big>(</big><em>channel=None</em>, <em>auth_key=None</em>, <em>ttl=1</em>, <em>callback=None</em>, <em>error=None</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTornado.revoke" title="Permalink to this definition">¶</a></dt> +<dd><p>Method for revoking permissions.</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string) (optional)</dt> +<dd>Specifies channel name to revoke permissions to. +If channel is not specified, the revoke applies to all +channels associated with the subscribe_key. If auth_key +is not specified, it is possible to grant permissions to +multiple channels simultaneously by specifying the channels +as a comma separated list.</dd> +<dt>auth_key:   (string) (optional) </dt> +<dd>Specifies auth_key to revoke permissions to. +It is possible to specify multiple auth_keys as comma +separated list in combination with a single channel name. +If auth_key is provided as the special-case value “null”  +(or included in a comma-separated list, eg. “null,null,abc”),  +a new auth_key will be generated and returned for each “null” value.</dd> +<dt>ttl:        (int) (default: 1440 i.e 24 hrs)</dt> +<dd>Time in minutes for which granted permissions are valid. +Max is 525600 , Min is 1. +Setting ttl to 0 will apply the grant indefinitely.</dd> +<dt>callback:   (function) (optional)</dt> +<dd>A callback method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado</dd> +<dt>error:      (function) (optional)</dt> +<dd>An error method can be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd><p class="first">Returns a dict in sync mode i.e. when callback argument is not given +The dict returned contains values with keys ‘message’ and ‘payload’</p> +<p>Sample Response: +{</p> +<blockquote> +<div><p>“message”:”Success”, +“payload”:{</p> +<blockquote> +<div><p>“ttl”:5, +“auths”:{</p> +<blockquote> +<div>“my_authkey”:{“r”:0,”w”:0}</div></blockquote> +<p>}, +“subscribe_key”:”my_subkey”, +“level”:”user”, +“channel”:”my_channel”</p> +</div></blockquote> +<p>}</p> +</div></blockquote> +<p class="last">}</p> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTornado.subscribe"> +<tt class="descname">subscribe</tt><big>(</big><em>channels</em>, <em>callback</em>, <em>error=None</em>, <em>connect=None</em>, <em>disconnect=None</em>, <em>reconnect=None</em>, <em>sync=False</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTornado.subscribe" title="Permalink to this definition">¶</a></dt> +<dd><p>Subscribe to data on a channel.</p> +<p>This function causes the client to create an open TCP socket to the +PubNub Real-Time Network and begin listening for messages on a specified channel. +To subscribe to a channel the client must send the appropriate subscribe_key at +initialization.</p> +<p>Only works in async mode</p> +<dl class="docutils"> +<dt>Args:</dt> +<dd><dl class="first last docutils"> +<dt>channel:    (string/list)</dt> +<dd>Specifies the channel to subscribe to. It is possible to specify +multiple channels as a comma separated list or andarray.</dd> +<dt>callback:   (function)</dt> +<dd>This callback is called on receiving a message from the channel.</dd> +<dt>error:      (function) (optional)</dt> +<dd>This callback is called on an error event</dd> +<dt>connect:    (function) (optional)</dt> +<dd>This callback is called on a successful connection to the PubNub cloud</dd> +<dt>disconnect: (function) (optional)</dt> +<dd>This callback is called on client disconnect from the PubNub cloud</dd> +<dt>reconnect:  (function) (optional)</dt> +<dd>This callback is called on successfully re-connecting to the PubNub cloud</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd>None</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTornado.time"> +<tt class="descname">time</tt><big>(</big><em>callback=None</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTornado.time" title="Permalink to this definition">¶</a></dt> +<dd><p>This function will return a 17 digit precision Unix epoch.</p> +<p>Args:</p> +<blockquote> +<div><dl class="docutils"> +<dt>callback:   (optional)</dt> +<dd>A callback method should be passed to the method. +If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</div></blockquote> +<dl class="docutils"> +<dt>Returns:</dt> +<dd><p class="first">Returns a 17 digit number in sync mode i.e. when callback argument is not given</p> +<dl class="last docutils"> +<dt>Sample:</dt> +<dd>13769501243685161</dd> +</dl> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="Pubnub.PubnubTornado.unsubscribe"> +<tt class="descname">unsubscribe</tt><big>(</big><em>channel</em><big>)</big><a class="headerlink" href="#Pubnub.PubnubTornado.unsubscribe" title="Permalink to this definition">¶</a></dt> +<dd><dl class="docutils"> +<dt>Subscribe to presence data on a channel.</dt> +<dd>Only works in async mode</dd> +<dt>Args:</dt> +<dd><p class="first">channel: Channel name ( string ) on which to publish message +message: Message to be published ( String / int / double / dict / list ). +callback: A callback method should be passed to the method.</p> +<blockquote> +<div>If set, the api works in async mode.  +Required argument when working with twisted or tornado .</div></blockquote> +<dl class="last docutils"> +<dt>error: Optional variable. An error method can be passed to the method.</dt> +<dd>If set, the api works in async mode.  +Required argument when working with twisted or tornado .</dd> +</dl> +</dd> +<dt>Returns:</dt> +<dd>Returns a list in sync mode i.e. when callback argument is not given</dd> +</dl> +</dd></dl> + +</dd></dl> + +</div> +</div> +<div class="section" id="indices-and-tables"> +<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline">¶</a></h1> +<ul class="simple"> +<li><a class="reference internal" href="genindex.html"><em>Index</em></a></li> +<li><a class="reference internal" href="search.html"><em>Search Page</em></a></li> +</ul> +</div> + + +          </div> +        </div> +      </div> +      <div class="sphinxsidebar"> +        <div class="sphinxsidebarwrapper"> +  <h3><a href="#">Table Of Contents</a></h3> +  <ul> +<li><a class="reference internal" href="#">Welcome to PubNub’s documentation!</a><ul> +<li><a class="reference internal" href="#pubnub">Pubnub</a></li> +<li><a class="reference internal" href="#pubnubtwisted">PubnubTwisted</a></li> +<li><a class="reference internal" href="#pubnubtornado">PubnubTornado</a></li> +</ul> +</li> +<li><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li> +</ul> + +  <h3>This Page</h3> +  <ul class="this-page-menu"> +    <li><a href="_sources/index.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><a href="#">PubNub 3.5.2 documentation</a> »</li>  +      </ul> +    </div> +    <div class="footer"> +        © Copyright 2014, PubNub Inc.. +      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2. +    </div> +  </body> +</html>
\ No newline at end of file | 
