w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
AttributeError: 'tuple' object has no attribute 'startswith' when using Python httplib

You're passing a tuple instead of a string:

>>> sig = 'sig'
>>> 'oauth/token?blahblah&' + 'sig=%s', sig
('oauth/token?blahblah&sig=%s', 'sig')
>>> 'oauth/token?blahblah&' + 'sig=%s' % sig
'oauth/token?blahblah&sig=sig'

Replace the following line:

token_url = "oauth/token?" + urlencode(ksort(params)) +
"&sig=%s",sig
                                                                 ^

with

token_url = "oauth/token?" + urlencode(ksort(params)) +
"&sig=%s"%sig




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.