Tuesday, 22 June 2010

Programmatically log on to a website using GAE(Google Appengine)

In GAE, urllib2.urlopen() series methods eventually call GAE's urlfetch() to do the job. At the time this post is written, there's no way to let Urlfetch understand cookie.

After some time, I found a solution here. It worked fine by far. Maybe some day I'll improve his class to some extent. My next app will heavily use this function.

Monday, 14 June 2010

How I bind custom domain name for GAE(in China mainland)

This is the third day spent on binding my custom domain to my app. I'm exausted and want to record the path I've gone. According to Google's manual page, this task should be very easy, which is true, for users OUTSIDE of PRC of course.

1. I tried as Google's official method, namely adding a CNAME to ghs.google.com from my domain admin tool and other stuff. This doesn't work for people in China because their goverment has blocked virtually of IPs of ghs.google.com.

2. After some googling I found loads of pages wrote by Chinese guys tring to solve this problem. They simply add A record pointing directly to one of the IP of ghs.google.com which was not blocked by the GOV. This is bad since using ghs.google.com is for load-balancing. Actually, this method won't even work since all IPs were blocked.

3. I tried DNS forwarding. Failed because no DNS server in China provide URL forwarding service and yahoo.com's forwarding service is blocked by GOV.

4. I figured maybe I'll have to use a third-party host to redirct for me, via the famouse .htaccess config. So I started searching for web hosting service. There are bunchs claiming to provide free web hosting. None of them function after the long registeration process. In fact, they share similar signing up UI and even identical tone when persviding you to their paid service. I spent more than one whole day registering various 'free' web hosting sites and almost want to kill myself in the end. The case is better in China, first there's no free providers, and the charging ones need some lisence from GOV. We are so living in a free country here!

5. Finally I found a free DNS forwarding service that is not blocked by our dear old GFW. I can't reveal its name in case our human rights activists will use it too much and bring GFW to shut it down. Yes, it worked.

I must say googling all day is not much fun and made me throw up. All the tools I used building the app is free, but using them in China need us to pay extra labor. Thanks to this great goverment.