Export to GitHub

pygooglevoice - issue #67

Message id not a SHA1 hash


Posted on Sep 12, 2012 by Quick Hippo

I have a script that I adopted from http://webapps.stackexchange.com/questions/9412/marking-all-google-voice-messages-as-read

Nearly all of the time, it fails with the error: Message id not a SHA1 hash

Here is the stack trace i receive:

Traceback (most recent call last): File "/home/chuck/bin/voice_mark_as_read", line 13, in <module> for message in folder.messages: File "/usr/local/lib/python2.7/dist-packages/googlevoice/util.py", line 242, in messages return [Message(self, *i) for i in self['messages'].items()] File "/usr/local/lib/python2.7/dist-packages/googlevoice/util.py", line 181, in init assert is_sha1(id), 'Message id not a SHA1 hash'

I'm running on Ubuntu 12.04.1 64 bit against a Google Voice account linked to Google apps if that makes any difference.

Comment #1

Posted on Sep 22, 2012 by Happy Rabbit

I encountered the same problem. I commented out the following lines of code in order to run the script.

util.py line 181 assert is_sha1(msg), 'Message id not a SHA1 hash'

voice.py line 241 assert is_sha1(msg), 'Message id not a SHA1 hash'

Comment #2

Posted on Dec 15, 2012 by Massive Bear

Honestly, that sounds like a terrible solution. There has to be another way to do this.

Comment #3

Posted on Jan 3, 2013 by Happy Kangaroo

That's the only solution at the moment, as the library doesn't understand that the Google API has changed to not always provide a valid SHA1 hash. It appears to return two different forms of hashes; but BOTH of them work just fine with the API. As long as the library doesn't check the IDs it's receiving from the API, and just passes them directly back into the API, it seems to work fine.

Of note, I'm using exactly the same script from Alex Brown on that StackExchange site; and it works absolutely fine if you comment out the temporarily-broken SHA1 checking.

Comment #4

Posted on Feb 12, 2015 by Swift Kangaroo

Comment deleted

Comment #5

Posted on Feb 12, 2015 by Swift Kangaroo

/usr/local/lib/python2.7/dist-packages/googlevoice/voice.py:

line 215: assert is_sha1(msg), 'Message id not a SHA1 hash'

I wrapped the assert statement like so:

    try:
        if not is_sha1(msg):
            raise Exception('Message id not a SHA1 hash')
    except Exception as e:
        print(e)
        pass

I think the culprit here is that the strings for the id's no longer match the regex. Perhaps no longer sha1?

sha1_re = re.compile(r'^[a-fA-F0-9]{40}$') def is_sha1(s): """ Returns True if the string is a SHA1 hash """ return bool(sha1_re.match(s))

An example id:

XGMJIXPKKXQUYHJOYUGUXZVRWKMTHGXGWUIKLUMT

So perhaps updating the sha1_re to something else would be the right way to fix the issue? As mentioned above, but I really have no idea what format this is.

err... relevant:

http://stackoverflow.com/questions/1668619/is-there-a-google-voice-api

Which after some perusing the closest thing that I could find is this?

https://developers.google.com/+/hangouts/api/gapi.hangout.data#gapi.hangout.data.getKeys

Which ... just a ?

Status: New

Labels:
Type-Defect Priority-Medium