Friday, January 29, 2010

Google Voice on App Engine

Google voice still doesn't release their official API, but some people already did some job so that we can use Google Voice more conveniently.


Chad Smith made the Google Voice Firefox addon, which is a great tool that you can use it with your Google Voice number and send SMS message without laving your browser. Chad also posted a topic to introduce how to place calls or send SMS using Google Voice via HTTP or XML request.

See: http://posttopic.com/topic/google-voice-add-on-development

According to Chad’s article, before Google release the API, to use Google Voice’s features in a standalone program is also possible. pygooglevoice is one of this kinds of open-source projects: http://code.google.com/p/pygooglevoice/ 

Scott Hillman also wrote a script with similar functions to use in command line.

http://everydayscripting.blogspot.com/2009/10/python-custom-google-voice-api.html


I tried to use their library/script in my Google App Engine based web application, and then I met a mess of problems.


Firstly, App Engine supply the URL fetch service API to work with HTTP request. Although you can also make HTTP request using urllib, urllib2 or httplib, but actually, all these kinds of routine call will be redirect to urlfetch API. But URL fetch service has a lot of limitation; it doesn’t handle the Cookies, so that you can't login to Google account in the background before send HTTP request to Google Voice.


Scott did a helper class to handle the Cookies and resolved the login issue.

http://everydayscripting.blogspot.com/2009/08/google-app-engine-cookie-handling-with.html


When I used his URLOpener class to login Google account in my program, I met the exception of "Stripped prohibited headers from URLFetch request: ['Host']". As Google does some restriction in the latest version of App Engine, some HTTP request headers will be recognized as distrustful. So I recommend you to delete the ‘Host’ parameter from headers in Scott’s class. The URLOpener still work normally after comment the “Host” parameter.


Then, I started to replace the HTTP request API in pygooglevoice with Scott’s URLOpener class, and some other problems arose.

pygooglevoice use ConfigParser to store the configuration properties, ConfigParse is not supported by App Engine, so you need to refactor this class. I changed the Conf class to inherit from appengine’s db.Model.

You may meet the encode problem when using pygooglevoice to send SMS message. I fixed the issue by unicode the input text and then encode it to utf-8 standard.

Everything is OK now, you can test the SMS sending feature on my home page: http://cpedia.net/ 



I will continue to work on a new open-source project, integrate pygooglevoice with all the fixes above together, and demonstrate a sample application on appspot.

http://code.google.com/p/googlevoice-gae/

Tags: voice, appengine, python, featured


Friday, February 06, 2009

Sorry for delay release of cpedialog 2.0

I had a business trip to US in the last 3 month, so I hardly got time to focus on this project.
But I am back now, so I will continue to work on it.

Please don't be hesitated to give me suggestion or feedback. Thanks for your support.

BTW: I took a lot photos during my period in US, welcome to access my updated albums @ http://blog.cpedia.com/albums/yeli.piao

Happy Niu Year!

Tags: cpedialog, cpedia, python, blog, albums, appengine


Wednesday, July 30, 2008

cpedialog listed on the Google Appengine open source projects

cpedialog 已经被列在google appengine group的open sourc项目列表里面了。

http://groups.google.com/group/google-appengine/web/google-app-engine-open-source-projects

另外,我更新了cpedialog在google code上的项目介绍,增加了一些screenshots。

http://code.google.com/p/cpedialog/

cpedia在appgallery的地址是:
http://appgallery.appspot.com/about_app?app_id
=agphcHBnYWxsZXJ5chMLEgxBcHBsaWNhdGlvbnMY6B4M


Tags: cpedialog, python, appengine


Thursday, July 17, 2008

My Projects

cpedialog


http://code.google.com/p/cpedialog

blog implemented by python and can be hosted on google appengine

Now you can access the Demo at: http://blog.cpedia.net

Features:

blog

  • using yui grid, so it's very easy to change or extend the page layout. auto-generate permalink url through translating the blog title by google.
  • tags for the blog entry.
  • rich content editor by yui rich editor.
  • Ajax implemented by simplejson & yui Connection Manager. (Such as inline editable table.)
  • Upload images file to bigTable in yui rich editor.
  • Uploaded images, tags, archives, albums management.
  • Menu & pages management.
  • AuthSub Session Token and System cache management.

albums

  • access the picasaweb albums through gdata API.
  • authSub implemented by decorating the python method.

cpediamond

will be moved to google code and renamed to cpediamond.
It's a DSL transform engineer. The previous version was called "Spring & Hibernate code generator"


googlevoice-gae


http://code.google.com/p/googlevoice-gae

Google voice unoffical api for Google App Engine.

This project is base on pygooglevoice , adapt it to Google App Engine Python environment.

This project aims to bring the power of the Google Voice API to the Google App Engine Python environment in a simple, easy-to-use manner. Currently it allows you to place calls, send sms, download voicemails/recorded messages, and search the various folders of your Google Voice Accounts. You can use the Python API to schedule calls, check for new received calls/sms, or even sync your recorded voicemails/calls.

You can refer to pygooglevoice's documentation. Documentation and example code is available online and provided in the extras package

If you want to learn more about this project, you can refer to my blog post here: http://blog.cpedia.net/2010/01/google-voice-on-app-engine


Tags: cpedialog, cpediamond, python, spring, hibernate, code_generator, DSL


Thursday, July 10, 2008

cpedialog程序开源

cpedialog已经落户到google code了,地址是 http://code.google.com/p/cpedialog/

如果你想在appengine上架设自己的站点,cpedialog是个不错的开始,尽管我们还没有发布测试版本,你仍然可以通过svn检出最新的代码。
 

# Non-members may check out a read-only working copy anonymously over HTTP.
svn checkout http://cpedialog.googlecode.com/svn/trunk/ cpedialog-read-only 
 

我们希望在第一个release时实现一些google service的整合,譬如picasaweb,calendar,docs等。

我们欢迎任何对appengine感兴趣,熟悉python的朋友加入cpedialog项目。有意者请给我发邮件:cpedia@gmail.com

 

Tags: cpedialog, appengine, python


Saturday, June 07, 2008

终于将博客迁移到google appengine

从对python一无所知,到将自己的博客程序(原为php)迁移到google的appengine仅仅用了不到一个星期的时间。


python真的很美,一切java里的经验都可以转移过来,我在实现基于google GqlQuery的分页类的时候几乎全盘借鉴以前实现的一个hibernate分页类。当然为了不重复造轮子,我还是扩展了django的paginator(最新版本的,而非appengine目前0.96的实现,0.96的ObjectPaginator已经不被赞成使用)。


虽然还有很多不完美的地方,尤其google Datastore的诸多限制,譬如数据一次最多只能fetch 1000条,cpu的使用限制,让我在将以前mysql里的数据导过来时费了很大一番周折。不过我会继续完善程序,谁叫我真的喜欢上了appengine和python呢。

Tags: appengine, python, django