コード例 #1
0
 def test_SendEncryptedStatusupdate(self):
     if userkeys:
         plaintext = 'Hello Twitter world'
         # keys
         pub = assemble_publickey(h1_keys['PublicKeyTwitter'])
         prk = h1_keys['PrivateKey']
         priv = assemble_privatekey((prk['p'], prk['g'], prk['x'], prk['iNumBits']))
         encrypted = encrypt_message(plaintext, pub)
         # Send
         twitter = Twython(consumer_key, consumer_sec, access_tok, access_token_sec)
         print(encrypted)
         send_status_update(twitter, encrypted)
         # read
         user_timeline = twitter.get_user_timeline(screen_name='HeteroT1', count=1, exclude_replies=True)
         lastmessage = user_timeline[0]['text']
         decrypted = decrypt_message(priv, lastmessage)
         print(decrypted)
         assert plaintext == decrypted
コード例 #2
0
 def test_send_plain_statusupdate(self):
     if userkeys:
         message = 'test_send_statusupdate. Time:  ' + str(d.now())
         twitter = Twython(consumer_key, consumer_sec, access_tok, access_token_sec)
         send_status_update(twitter, message)