try something like this
def _AddAuthorizationHeader(self, username, password):
if username and password:
basic_auth = base64.encodestring('%s:%s' % (username, password))
[:-1]
self.request_headers['Authorization'] = 'Basic %s' % basic_auth
On Nov 23 2008, 7:31 pm, Amir Michail <[email protected]> wrote:
> On Nov 22, 5:35 pm, Amir Michail <[email protected]> wrote:
>
> > Hi,
>
> > I'm stuck on the authorization part:
>
> Update: both the local and deployed versions result in an
> authentication failure.
>
> Any hints on how I could debug this?
>
> Amir
>
>
>
> > if self._username and self._password:
> > self._AddAuthorizationHeader(self._username, self._password)
> > print "self._request_headers = "+`self._request_headers`
>
> > requestBody = urllib.urlencode(self._request_headers)
> > url_data = urlfetch.fetch(url,
> > method=urlfetch.POST,
> > headers={'Content-type':
> > 'application/x-www-form-
> > urlencoded',
> > 'Content-Length':
> > str(len(requestBody))},
> > payload=requestBody).content
>
> > This gives the following exception when a username and password are
> > supplied:
>
> > ...\src\twitter.py in NewFromJsonDict(data=u'request')
> > 547 else:
> > 548 status = None
> > 549 return User(id=data.get('id', None),
> > 550 name=data.get('name', None),
> > 551 screen_name=data.get('screen_name', None),
> > global User = <class 'twitter.User'>, builtin id = <built-in function
> > id>, data = u'request', data.get undefined, builtin None = None, name
> > undefined, screen_name undefined, location undefined, description
> > undefined, profile_image_url undefined, url undefined, status = None
> > <type 'exceptions.AttributeError'>: 'unicode' object has no attribute
> > 'get'
>
> > Any ideas how to get this to work?
>
> > Amir
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---