Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

auth.py uses bytearray.tostring, which doesn't seem to exist #37

@trinarytree

Description

@trinarytree

auth.py uses tostring in exactly 1 place, which causes the following test to fail for me:

ERROR: testSecureAuthSubGetAuthHeader (gdata_tests.auth_test.TokenClassesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/ccalabro/code/python/gdata-python-client/tests/gdata_tests/auth_test.py", line 514, in testSecureAuthSubGetAuthHeader
    auth_header = token.GetAuthHeader('GET', url)
  File "/Library/Python/2.7/site-packages/gdata/auth.py", line 943, in GetAuthHeader
    sig = encodestring(self.rsa_key.hashAndSign(data).tostring()).rstrip()
AttributeError: 'bytearray' object has no attribute 'tostring'

The output of hashAndSign is a bytearray (for me it is anyway, is it not for the author?), which doesn't have a tostring method, at least, it doesn't in python 2.7.1, which INSTALL.txt claims this project supports. Actually, I can't find any version of python where bytearray has a tostring method. Why not just use str(self.rsa_key.hashAndSign(data)) instead?
I believe this bug was introduced by commit 3c85d33.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions