Commits

Cédric Bonhomme  committed f3084c0

Removed OpenPhoto dependency.

  • Participants
  • Parent commits f42402e

Comments (0)

Files changed (1)

 # along with this program.  If not, see <http://www.gnu.org/licenses/>
 
 __author__ = "Cedric Bonhomme"
-__version__ = "$Revision: 0.3 $"
+__version__ = "$Revision: 0.4 $"
 __date__ = "$Date: 2012/07/13 $"
-__revision__ = "$Date: 2012/07/23 $"
+__revision__ = "$Date: 2013/01/28 $"
 __copyright__ = "Copyright (c) Cedric Bonhomme"
 __license__ = "GPLv3"
 
 import cgi
 import json
 
-from openphoto import OpenPhoto
-
 form = cgi.FieldStorage()
 address = form.getvalue("address", "photos.cedricbonhomme.org")
 
 html = '<html>\n' + \
-        '<head>\n\t<title>Photos</title>\n' + \
-        '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>\n' + \
-        '<link rel="stylesheet" type="text/css" href="./style.css" />\n'
+        '<head>\n\t<meta charset="utf-8" />\n\t<title>Photos</title>\n\t' + \
+        '<link rel="stylesheet" href="./style.css" />\n'
 
 resp = None
 try:
-    client = OpenPhoto(host=address)
-    resp = json.loads(client.get('/photos/list.json', {'pageSize':'1000'}))
+    html = urllib.request.urlopen(address+"/photos/list.json?pageSize=1000")
+    text = html.read()
+    resp = json.loads(text.decode())
 except:
     html += '</head>\n'
     html += '<body>\n'
 
 # Finally print the web page.
 print "Content-type:text/html\r\n\r\n"
-print html
+print html