simplegeo / python-simplegeo

A client interface for SimpleGeo's API.
http://simplegeo.com
104 stars 18 forks source link

Error with _request - header is str instead of int #24

Open pamelafox opened 13 years ago

pamelafox commented 13 years ago

In simplegeo/_init.py, line 143: if self.headers['status'][0] not in ('2', '3'): raise APIError(int(self.headers['status']), content, self.headers)

When I run that on my machine (App Engine dev server), I get error that int is unsubscriptable, because it gets an int for the status, not a str. I fixed it by wrapping it in str().

I'm not sure if it's that my httplib2 is more modern or less than what's expected, I have 0.7.1, downloaded today.

jongrall commented 13 years ago

I had the same issue. Also on AppEngine dev server, with httplib2 v.0.7.1 downloaded from the Google Code site. It's still in the latest version of the SimpleGeo library, this time on line 150.

Solution: make sure self.headers['status'] is actually a string by calling str() on it.

if self.headers['status'][0] not in ('2', '3'):

becomes

if str(self.headers['status'])[0] not in ('2', '3'):

echamberlain commented 13 years ago

Issue fixed in the pull request associated with issue #30.