Google App Engine builds Twitter API proxy

Source: Internet
Author: User
Tags tortoisesvn
I re-installed my computer today and accidentally forgot to save the original Twitter API address. I couldn't find it for a long time. I just watched this article.
An API proxy of your own. It's good. I learned it!
Welcome to my Twitter account @ bingw.zh.

Google App Engine: Building Twitter API proxy-[technical experience
]

Copyright Notice
: During reprinting, please use hyperlinks to indicate the original source and author information of the article and this statement

Http://walkingway.blogbus.com/logs/48414404.html

This article is only for technical discussion and has nothing to do with the penetration through the wall. Most of the materials come from the Internet and Google, and are supplemented by my own practices. It is suitable for beginners who have no concept at all. Welcome to follow my Twitter: @ walkingway

I. Literacy

1. What is Twitter API proxy?

Generally, HTTP requests have two different forms,Post
AndGet
(In fact, there are some other requests, This article briefly ). "Twitter rest API" is also called in these two forms.

If we call the Twitter rest API through third-party applications or third-party programming languages, is it similar to the proxy we usually use? Here, the Twitter API proxy is self-evident!

Simply put, the post and get requests sent from the client are forwarded to the original API address and the returned HTTP
The header and content are returned to the client, implementing the original Twitter
All functions of the API. In addition to providing an API address option for configuration, the client does not need to make any code changes (This section is described by the twip author and is simple and clear)

In the following scenario, the most common method for you to view the information of an upstream user is to directly view the information on Twitter.com. In fact, the following request is called:
Get http://twitter.com/statuses/show/twitterapi.json

If you use third-party applications or third-party programming calls as another request method, suppose you set up a Twitter API proxy at http://none.com/apiarchitecture, you can call the same API in the following ways:

Get http://none.com/api/status/show/twitterapi.json gets the same effect.

2. What is Google App Engine?

Google App Engine
Is an online application platform provided by Google that supports Python and Java. Simply put, a program written in Python/Java is directly run on the Google App Engine, and the Google App Engine provides network space and bandwidth.

Ii. Objectives

OK. The next step isGoogle App Engine
Build your ownTwitter API proxy
What should I do without programming? It doesn't matter. In the Internet era, there are too many open-source resources. Today, some of the source code we use comes fromBirdnes

Http://code.google.com/p/birdnest/
), A well-known Twitter API proxy, from Google
For an open-source project on code, it requires space to support the Python language to run. Google App Engine supports python.
The App Engine introduces the setup method, So Google is a pretty good thing.

Iii. Implementation

1. Environment preparation: Google App Engine

Register Google App Engine first, register address http://appengine.google.com/
And then create an application

 

For the first use, the user's mobile phone needs to be verified. Enter the mobile phone number to receive the verification code.

EnterApplication Identifier
(Enter the application address you want and you will get a yourid.appspot.com domain name. Remember this .) AndApplication title
(Title, random) and check and agree to the terms of service, clickSave
The creation is complete.

In addition, you need to download and installGoogle App Engine
Development Environment, notePython
OfVersion
, Which must be of the 2.5 series. version 2.6 or later cannot be used. Otherwise, an error occurs during running.

Google App Engine SDK http://code.google.com/intl/zh-CN/appengine/downloads.html

Python 2.5.4 http://www.javaeye.com/news/4633

It's easy, all the wayNext
Install it.

2. Environment preparation: birdnest

Download birdnestNote that branches/Gae

,Do not download the trunk
Otherwise, an error will be reported if it is not available when it is updated to Gae. A svn tool is required for downloading, for example, tortoisesvn.

Tortoisesvn: http://tortoisesvn.net/downloads
(Pay attention to the language packs downloading. Ignore the good English kids shoes)

Tortoisesvn usage: After the download and installation are completeGoogle App Engine
Installation Directory (for example, under my E:/Google/google_appengine)Create a folder
, Set a random name (My justinwayy ),Right-click a folder
, SelectSVN Detection
And then fill in the version library URLBirdnest/Gae URL
(Http://birdnest.googlecode.com/svn/branches/gae/
), And click OK.

Go to the checked folder and use NotePad to open an app. in the yaml file, change the parameter nest after the application in the first line to your application name (yourid), and click Save.

3. Publish the application to Gae

After you have prepared everything above, you can publish this application to your appspot, open the command prompt (Click Start> RUN> cmd), and enterX:/Google/google_appengine directory
(InputCd x:/Google/google_appengine/
),Enter the following command line: appcfg. py update directory name
(My justinwayy ).Gmail Username
AndPassword
And then you can use it. The API address you created should beYourid.appspot.com/api/

 

4. Use

So far, we have successfully set up our own Twitter API proxy, yourid.appspot.com, which can be used on all clients that allow custom API functions. Please try it.

InTwhirl
In, open account management accounts manager, select the laconi. Ca Account type, enter [your Twitter account name] @ yourid.appspot.com, And the password is the Twitter password.

InTwitterfox
Li
To open C:/Documents and Settings/Administrator/Application
Data/Mozilla/Firefox/profiles/random information
. Default/extensions/twitternotifier@naan.net/components directory, Edit
The nstwitterfox. js file is directly located in documents and
Search for the nstwitterfox. js file in settings, edit the 38 lines of the file, and change it to VaR twitter_api_url =
Http://yourid.appspot.com/api.

---------------------------------- Thank you for the demarcation line ----------------------------------

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.