community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1636615 - /comdev/nearby_people/lib/geoname.py
Date Tue, 04 Nov 2014 15:48:41 GMT
Author: nick
Date: Tue Nov  4 15:48:40 2014
New Revision: 1636615

URL: http://svn.apache.org/r1636615
Log:
urllib doesn't like unicode strings, so change those to utf8

Modified:
    comdev/nearby_people/lib/geoname.py

Modified: comdev/nearby_people/lib/geoname.py
URL: http://svn.apache.org/viewvc/comdev/nearby_people/lib/geoname.py?rev=1636615&r1=1636614&r2=1636615&view=diff
==============================================================================
--- comdev/nearby_people/lib/geoname.py (original)
+++ comdev/nearby_people/lib/geoname.py Tue Nov  4 15:48:40 2014
@@ -26,6 +26,12 @@ def fetchJson(method, dparams):
          else:
              for v in value:
                  params.append((key,v))
+    # urllib doesn't like unicode strings, so change those to utf8
+    for i in range(len(params)):
+        kv = params[i]
+        if isinstance(kv[1], unicode):
+           params[i] = (kv[0], kv[1].encode('utf-8'))
+    # Build the url
     uri = DOMAIN + '%s?%s&username=%s' % (method, urllib.urlencode(params), USERNAME)
     if DEBUG:
         print uri



Mime
View raw message