Skip to content

Commit a9e27d2

Browse files
author
Paul Tagliamonte
committed
Adding in some URL encoding fixes
1 parent b374428 commit a9e27d2

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2012-04-12 Paul Tagliamonte <[email protected]>
2+
3+
* sunlight/services/capitolwords.py: Fixed a URL Encoding issue that was
4+
sitting there, undiscovered. Thanks, dandrinkard!
5+
16
2012-02-27 James Turk <[email protected]>
27

38
[James]

sunlight/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"""
1212

1313
__appname__ = "sunlight"
14-
__version__ = "1.1.1"
14+
__version__ = "1.1.2"
1515

1616
import sunlight.services.openstates
1717
import sunlight.services.capitolwords

sunlight/services/capitolwords.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,12 @@ def text( self, phrase=None, title=None, **kwargs ):
9292
# API impl methods below
9393

9494
def _get_url( self, obj, apikey, **kwargs ):
95-
ret = "%s/%s.json?apikey=%s" % (
95+
ret = "%s/%s.json?apikey=%s&%s" % (
9696
service_url,
9797
obj,
98-
apikey
98+
apikey,
99+
sunlight.service.urlencode(kwargs)
99100
)
100-
for arg in kwargs:
101-
ret += "&%s=%s" % ( arg, kwargs[arg] )
102101
return ret
103102

104103
def _decode_response( self, response ):

sunlight/services/influenceexplorer.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,12 @@ def entities(self, **kwargs):
7979
# API impl methods below
8080

8181
def _get_url( self, obj, apikey, **kwargs ):
82-
ret = "%s/%s.json?apikey=%s" % (
82+
return "%s/%s?apikey=%s&%s" % (
8383
service_url,
8484
obj,
85-
apikey
85+
apikey,
86+
sunlight.service.urlencode(kwargs)
8687
)
87-
for arg in kwargs:
88-
ret += "&%s=%s" % ( arg, kwargs[arg] )
89-
return ret
9088

9189
def _decode_response( self, response ):
9290
ret = json.loads( response )

0 commit comments

Comments
 (0)