summary refs log tree commit diff stats
path: root/doc/pydoc/ranger.ext.openstruct.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/pydoc/ranger.ext.openstruct.html')
-rw-r--r--doc/pydoc/ranger.ext.openstruct.html8
1 files changed, 4 insertions, 4 deletions
diff --git a/doc/pydoc/ranger.ext.openstruct.html b/doc/pydoc/ranger.ext.openstruct.html
index 206dbfe0..4df349ce 100644
--- a/doc/pydoc/ranger.ext.openstruct.html
+++ b/doc/pydoc/ranger.ext.openstruct.html
@@ -1,6 +1,6 @@
+
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <html><head><title>Python: module ranger.ext.openstruct</title>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 </head><body bgcolor="#f0f0f8">
 
 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
@@ -8,7 +8,7 @@
 <td valign=bottom>&nbsp;<br>
 <font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="ranger.html"><font color="#ffffff">ranger</font></a>.<a href="ranger.ext.html"><font color="#ffffff">ext</font></a>.openstruct</strong></big></big></font></td
 ><td align=right valign=bottom
-><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/hut/work/ranger/ranger/ext/openstruct.py">/home/hut/work/ranger/ranger/ext/openstruct.py</a></font></td></tr></table>
+><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/hut/ranger/ranger/ext/openstruct.py">/home/hut/ranger/ranger/ext/openstruct.py</a></font></td></tr></table>
     <p><tt>#&nbsp;Copyright&nbsp;(c)&nbsp;2009,&nbsp;2010&nbsp;hut&nbsp;&lt;hut@lavabit.com&gt;<br>
 #<br>
 #&nbsp;Permission&nbsp;to&nbsp;use,&nbsp;copy,&nbsp;modify,&nbsp;and/or&nbsp;distribute&nbsp;this&nbsp;software&nbsp;for&nbsp;any<br>
@@ -30,7 +30,7 @@
     
 <tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
 <td width="100%"><dl>
-<dt><font face="helvetica, arial"><a href="builtins.html#object">builtins.object</a>
+<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
 </font></dt><dd>
 <dl>
 <dt><font face="helvetica, arial"><a href="ranger.ext.openstruct.html#OpenStruct">OpenStruct</a>
@@ -41,7 +41,7 @@
 <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
 <tr bgcolor="#ffc8d8">
 <td colspan=3 valign=bottom>&nbsp;<br>
-<font color="#000000" face="helvetica, arial"><a name="OpenStruct">class <strong>OpenStruct</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
+<font color="#000000" face="helvetica, arial"><a name="OpenStruct">class <strong>OpenStruct</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
     
 <tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
 <td width="100%">Methods defined here:<br>
ass="kn">import ( "encoding/json" "fmt" "math/rand" "tildegit.org/andinus/cetus/request" ) // BPOD holds the response from the api. type BPOD struct { StartDate string `json:"startdate"` FullStartDate string `json:"fullstartdate"` EndDate string `json:"enddate"` URL string `json:"url"` URLBase string `json:"urlbase"` Copyright string `json:"copyright"` CopyrightLink string `json:"copyrightlink"` Title string `json:"title"` Hsh string `json:"hsh"` } // List holds the list of BPOD. type List struct { Photos []BPOD `json:"images"` } // MarshalJson takes res as input and returns body. This remarshaling // is required because of a bug. To learn about why this is required, // remove this function & then run `cetus set bpod -random`. Put a // `fmt.Println(res, body)` somewhere and look at how they differ. res // will contain a single entry but body will have all 7 entries which // is bad because body is cached to disk to view later. func MarshalJson(res BPOD) (string, error) { out, err := json.Marshal(res) if err != nil { err = fmt.Errorf("%s\n%s", "MarshalJson failed", err.Error()) } body := string(out) return body, err } // UnmarshalJson will take body as input & unmarshal it to res, func UnmarshalJson(body string) (BPOD, error) { list := List{} res := BPOD{} err := json.Unmarshal([]byte(body), &list) if err != nil { return res, fmt.Errorf("UnmarshalJson failed\n%s", err.Error()) } res = list.Photos[rand.Intn(len(list.Photos))] return res, nil } // GetJson takes reqInfo as input and returns the body and an error. func GetJson(reqInfo map[string]string) (string, error) { // reqInfo is map[string]string and params is built from it, // currently it takes apiKey and the date from reqInfo to // build param. If any new key/value is added to reqInfo then // it must be addded here too, it won't be sent as param // directly. params := make(map[string]string) params["format"] = "js" params["n"] = "1" // if random is true then fetch 7 photos if reqInfo["random"] == "true" { params["n"] = "7" } body, err := request.GetRes(reqInfo["api"], params) return string(body), err }