Пример #1
0
 def delete(self, username):
     if not username == self.get_session()[u'username']:
         raise HTTPError(403)
     
     auth = TwitterAuth.get({u'username': username})
     if auth is None:
         raise HTTPError(404)
     
     auth.delete()
Пример #2
0
 def get(self, username):
     if not username == self.get_session()[u'username']:
         raise HTTPError(403)
     
     auth = TwitterAuth.get({u'username': username})
     if auth is None:
         raise HTTPError(404)
     
     self.output({u'token': auth[u'token'], u'secret': auth[u'secret']}, 200)
Пример #3
0
 def put(self, username):
     if not username == self.get_session()[u'username']:
         raise HTTPError(403)
     
     if TwitterAuth.get({u'username': username}) is not None:
         raise HTTPError(409)
     
     try:
         auth = {
             u'token': self.body_dict()[u'token'], 
             u'secret': self.body_dict()[u'secret'],
             u'username': username,
         }
     except KeyError, e:
         self.output({'error': 'MISSING_FIELD',
                      'field': e}, 400)