votesmart / python-votesmart

python client library for interacting with Project Vote Smart API
Other
84 stars 40 forks source link

maybe another empty string? #7

Closed jcii closed 12 years ago

jcii commented 13 years ago

Hi again,

So I'm still learning python, or I'd just fix these and submit the patch. I did look over your commit changes. Here is another I found; I don't know if it's the same empty string error or not:

for officeType in votesmart.office.getTypes():
    #print repr(officeType)
    print officeType.name
    for office in votesmart.office.getOfficesByType(officeType.officeTypeId):
        print repr(office)

It errors out at iterating through "Local Judicial" officeType:

Local Judicial Traceback (most recent call last): File "/home/jimmy/workspace/votesmart/src/offices.py", line 11, in for office in votesmart.office.getOfficesByType(officeType.officeTypeId): File "/usr/local/lib/python2.6/dist-packages/votesmart.py", line 453, in getOfficesByType result = votesmart._apicall('Office.getOfficesByType', params) File "/usr/local/lib/python2.6/dist-packages/votesmart.py", line 215, in _apicall raise VotesmartApiError(obj['error']['errorMessage']) votesmart.VotesmartApiError: No offices for this office type

jamesturk commented 13 years ago

I think that one is just a lack of ofices in their system using that office type, I'll talk to my contact there and ask though.

-James

On Fri, Jun 17, 2011 at 5:57 PM, jcii < reply@reply.github.com>wrote:

Hi again,

So I'm still learning python, or I'd just fix these and submit the patch. I did look over your commit changes. Here is another I found; I don't know if it's the same empty string error or not:

for officeType in votesmart.office.getTypes():

print repr(officeType)

   print officeType.name
   for office in

votesmart.office.getOfficesByType(officeType.officeTypeId): print repr(office)

It errors out at iterating through "Local Judicial" officeType:

Local Judicial Traceback (most recent call last): File "/home/jimmy/workspace/votesmart/src/offices.py", line 11, in

for office in votesmart.office.getOfficesByType(officeType.officeTypeId): File "/usr/local/lib/python2.6/dist-packages/votesmart.py", line 453, in getOfficesByType result = votesmart._apicall('Office.getOfficesByType', params) File "/usr/local/lib/python2.6/dist-packages/votesmart.py", line 215, in _apicall raise VotesmartApiError(obj['error']['errorMessage']) votesmart.VotesmartApiError: No offices for this office type ## Reply to this email directly or view it on GitHub: https://github.com/sunlightlabs/python-votesmart/issues/7
jcii commented 13 years ago

Should I do some status check on the returned object? defined or something like that?

Also, I can probably take what I'm doing and turn them into some type of integration/end-to-end test for you. I intend to walk everything; I'm shoving it all into a database on my end. Would that be of use?