tag:blogger.com,1999:blog-5484413222728812890.post2654832898112871694..comments2022-04-04T07:56:54.706-07:00Comments on Every Day Scripting: Python - Google Voice part 2Scott Hillmanhttp://www.blogger.com/profile/14751342469827168317noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-5484413222728812890.post-25947122054210790702009-08-20T12:58:37.856-07:002009-08-20T12:58:37.856-07:00Ben -
Sure thing. Since this post is about Pytho...Ben - <br /><br />Sure thing. Since this post is about Python, and that is the only language I have used to access the "_rnr_se" so far, I can offer a Python solution. <br /><br /># Using regex to get the _rnr_se value<br />import re<br /># Use the urllib2 opener<br />import urllib2, urllib<br /># Set up an opener with HTTPCookieProcessor<br />self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())<br /> urllib2.install_opener(self.opener)<br /><br /># Set up login credentials for Google Accounts<br /># The 'continue' param redirects us to the Google Voice <br /># homepage, and gives us necessary cookie info<br />loginParams = urllib.urlencode( { <br /> 'Email' : email,<br /> 'Passwd' : password,<br /> 'continue' : 'https://www.google.com/voice/account/signin'<br /> } )<br /><br /># Perform the login. Cookie info sent back will be saved, so we remain logged in<br /># for future requests when using the opener<br />self.opener.open( 'https://www.google.com/accounts/ServiceLoginAuth', loginParams)<br /><br /># Need to load the homepage to find user specific data<br />googleVoiceHomeData = self.opener.open('https://www.google.com/voice/#inbox').read()<br /><br /># Go through the home page and grab the value for the hidden<br /># form field "_rnr_se", which must be included when sending texts and dealing with calls<br />match = re.search('name="_rnr_se".*?value="(.*?)"', googleVoiceHomeData)<br /><br />_rnr_se = match.group(1)<br /><br />If you aren't using Python, you can still use that regular expression that I use. Just Use the regular expression on a page's contents that will contain the value. <br /><br />If that doesn't work, or you have a more specific question, go ahead and email me at [hillmanov at yahoo dot com].Scott Hillmanhttps://www.blogger.com/profile/14751342469827168317noreply@blogger.comtag:blogger.com,1999:blog-5484413222728812890.post-64153900054531076132009-08-20T08:18:08.257-07:002009-08-20T08:18:08.257-07:00Scott, not sure if you can help me, but I am prett...Scott, not sure if you can help me, but I am pretty much a noob, but am working on an XML module for just sending calls with GV. As of now, I am using the XML from the google.com/voice/m interface for the call form, and just made it so it opens the calling window in a new window. But, I am having trouble retrieving the _rnr_se value which is needed for the form. Since the module will be running within a users google account, it should be as easy as parsing out the value from any of the google voice pages and then using the parsed var in the form. Unfortunately, I can't seem to make this work. If you could offer me any assistance on this very simple issue, I would much appreciate it, since this gadget is more for personal use than anything.Anonymoushttps://www.blogger.com/profile/02850712149284877836noreply@blogger.com