Ejemplo n.º 1
0
 def url(self):
     try:
         uid = self._data['user']['id']
         mid = get_mid(self._data['mid'])
     except KeyError:
         # Sometimes Sina's API doesn't return user
         # when our tweet is deeply nested. Just forgot it.
         return ""
     return 'http://weibo.com/%s/%s' % (uid, mid)
Ejemplo n.º 2
0
 def test_get_mid(self):
     self.assertEqual(get_mid("3591268992667779"), 'zCik3bc0H')
     self.assertEqual(get_mid("3591370117495972"), 'zCkX9vs2M')
     self.assertEqual(get_mid("3591291856713634"), 'zCiUVsawq')
Ejemplo n.º 3
0
 def mid(self):
     decimal_mid = str(self._data.get('mid'))
     encode_mid = get_mid(decimal_mid)
     return encode_mid
Ejemplo n.º 4
0
 def test_get_mid(self):
     self.assertEqual(get_mid("3591268992667779"), 'zCik3bc0H')
     self.assertEqual(get_mid("3591370117495972"), 'zCkX9vs2M')
     self.assertEqual(get_mid("3591291856713634"), 'zCiUVsawq')