---
title: "Twiit Your Google Status"
description: "After Finding invisible mates I tried a simple python script again to do me a neat job of twitting and setting the same as."
url: "https://h3manth.com/scribe/twiit-your-google-status/"
canonical_url: "https://h3manth.com/scribe/twiit-your-google-status/"
markdown_url: "https://h3manth.com/scribe/blog/twiit-your-google-status.md"
publishDate: "2010-07-28T00:00:00.000Z"
author: "Hemanth HM"
category: "python"
tags: ["python","bash","web"]
word_count: 171
reading_time_minutes: 1
x_markdown_tokens: 572
content_signal: "ai-train=yes, search=yes, ai-input=yes"
---

# Twiit Your Google Status

> After Finding invisible mates I tried a simple python script again to do me a neat job of twitting and setting the same as.

##  Most of the time we share a link in our Gtalk status, so do we tweet the same, would it not be fun and easy to do the same from CLI?!

After [Finding invisible mates](http://www.h3manth.com/content/find-your-invisible-friends-gmail) I tried a simple python script again to do me a neat job of twitting and setting the same as by gamil status.
    
    
    import sys
    import warnings
    from xmpp import *
    import urllib
    
    # Don you dare warn me!
    warnings.filterwarnings("ignore") 
    
    #### EDIT THE BELOW ####
    GUSERNAME = "hemanth.hm"
    GPASSWORD = "YOU_KNOW_IT"
    RESOURCE = "gmail.com"
    
    TUSER="hemanth_hm"
    TPASS="DON_YOU_KNOW?"
    #######################
    
    class Gtweet:
        def __init__(self, stats=None):
            self.stats = stats
        def gstat(self):
            cl=Client(server='gmail.com',debug=[])
            if not cl.connect(server=('talk.google.com',5222)):
                raise IOError('Can not connect to server.')
            if not cl.auth(GUSERNAME, GPASSWORD, RESOURCE):
                raise IOError('Can not auth with server.')
            cl.send(Iq('set','google:shared-status', payload=[
                    Node('show',payload=['status']),
                    Node('status',payload=[self.stats])
            ]))
            cl.disconnect()
        
        def twit(self):
            try:
                data = urllib.urlencode({"status" :self.stats})
                res = urllib.urlopen("http://%s:%s@twitter.com/statuses/update.xml"\
                                  % (TUSER,TPASS),data)
            except Exception, why:
                print str(why)
    
    def main():
        status = raw_input("Type in your status: ")
        gt = Gtweet(status)
        gt.twit()
        gt.gstat()
    
    if __name__ == "__main__":
        main()
    

[ Get the code here](http://github.com/hemanth/futhark/raw/master/TwittGtalk.py)
