Legislators by Geo Code

38 views
Skip to first unread message

Tom Curran

unread,
Mar 8, 2016, 1:32:03 PM3/8/16
to Open State Project
Hello - 

I have a list of GeoCodes that I want to find the state legislators for using the legislator_geo_search. 

I am using python and iterating through the data frame passing latitude and longitude variables to the function but I keep getting this errorr:

raceback (most recent call last):
  File "/Users/TomCurran/PycharmProjects/Plotly/sunglight_senate.py", line 22, in <module>
    ok_rep = sunlight.openstates.legislator_geo_search(lat, lon)
  File "/Library/Python/2.7/site-packages/sunlight/services/openstates.py", line 103, in legislator_geo_search
    return self.get(["legislators", "geo"], **kwargs)
  File "/Library/Python/2.7/site-packages/sunlight/service.py", line 83, in get
    raise ex
sunlight.errors.BadRequestException: 'Error (502) -- <html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body bgcolor="white">\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>nginx/1.4.1 (Ubuntu)</center>\r\n</body>\r\n</html>\r\n'


When I pass string through - example sunlight.openstates.legislator_geo_search('XX.XXXX', 'YY.YYYY') I can get a JSON back.

Suggestions?


dmc...@sunlightfoundation.com

unread,
Mar 9, 2016, 9:45:33 AM3/9/16
to Open State Project
Hi Tom,

This appears to be a duplicate question. Please confirm.

Thank you,

Don McLamb
Software Developer
Sunlight Foundation
Reply all
Reply to author
Forward
0 new messages