Remove examples and move into tweepy-examples repository.
authorJosh Roesslein <jroesslein@gmail.com>
Mon, 2 Nov 2009 22:13:17 +0000 (16:13 -0600)
committerJosh Roesslein <jroesslein@gmail.com>
Mon, 2 Nov 2009 22:13:17 +0000 (16:13 -0600)
14 files changed:
examples/README [deleted file]
examples/appengine/app.py [deleted file]
examples/appengine/app.yaml [deleted file]
examples/appengine/error.html [deleted file]
examples/appengine/index.yaml [deleted file]
examples/appengine/oauth_example/__init__.py [deleted file]
examples/appengine/oauth_example/callback.html [deleted file]
examples/appengine/oauth_example/handlers.py [deleted file]
examples/appengine/oauth_example/main.html [deleted file]
examples/appengine/oauth_example/models.py [deleted file]
examples/appengine/tweepy.zip [deleted file]
examples/bg.png [deleted file]
examples/oauth/getaccesstoken.py [deleted file]
examples/profile.png [deleted file]

diff --git a/examples/README b/examples/README
deleted file mode 100644 (file)
index 975ac7a..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-Tweepy Examples
-===============
-
-appengine
----------
-Demonstrates using Tweepy along with appengine.
-Currently shows how to implement OAuthHandler properly.
-
-Example Contributions
----------------------
-If you have an example you would like to offer, please
-email tweepy@googlegroups.com or send me a pull request
-on github or gitorious.
-
-License
--------
-All examples here are public domain unless
-otherwise specified within the example's code files.
diff --git a/examples/appengine/app.py b/examples/appengine/app.py
deleted file mode 100644 (file)
index a1cf44b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-from google.appengine.ext import webapp
-from google.appengine.ext.webapp.util import run_wsgi_app
-
-import sys
-sys.path.insert(0, 'tweepy.zip')
-
-import oauth_example.handlers
-
-# Construct the WSGI application
-application = webapp.WSGIApplication([
-
-        # OAuth example
-        (r'/oauth/', oauth_example.handlers.MainPage),
-        (r'/oauth/callback', oauth_example.handlers.CallbackPage),
-
-], debug=True)
-
-def main():
-    run_wsgi_app(application)
-
-# Run the WSGI application
-if __name__ == '__main__':
-    main()
diff --git a/examples/appengine/app.yaml b/examples/appengine/app.yaml
deleted file mode 100644 (file)
index 6f9e636..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-application: tweepy-demo
-version: 1
-runtime: python
-api_version: 1
-
-handlers:
-- url: /.*
-  script: app.py
-
diff --git a/examples/appengine/error.html b/examples/appengine/error.html
deleted file mode 100644 (file)
index 417572a..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<html>
-
-    <head>
-        <title>Tweepy OAuth Example -- Error!</title>
-    </head>
-
-    <body>
-        <h1>{{message}}</h1>
-    </body>
-
-</html>
diff --git a/examples/appengine/index.yaml b/examples/appengine/index.yaml
deleted file mode 100644 (file)
index a3b9e05..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-indexes:
-
-# AUTOGENERATED
-
-# This index.yaml is automatically updated whenever the dev_appserver
-# detects that a new type of query is run.  If you want to manage the
-# index.yaml file manually, remove the above marker line (the line
-# saying "# AUTOGENERATED").  If you want to manage some indexes
-# manually, move them above the marker line.  The index.yaml file is
-# automatically uploaded to the admin console when you next deploy
-# your application using appcfg.py.
diff --git a/examples/appengine/oauth_example/__init__.py b/examples/appengine/oauth_example/__init__.py
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/examples/appengine/oauth_example/callback.html b/examples/appengine/oauth_example/callback.html
deleted file mode 100644 (file)
index 58bc2bd..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<html>
-
-    <head>
-        <title>Tweepy OAuth Example -- callback</title>
-    </head>
-
-    <body>
-        <h1>Success!</h1>
-        <h1>Access token</h1>
-        <ul>
-            <li><b>Key:</b> {{access_token.key}}</li>
-            <li><b>Secret:</b> {{access_token.secret}}</li>
-        </ul>
-    </body>
-
-</html>
diff --git a/examples/appengine/oauth_example/handlers.py b/examples/appengine/oauth_example/handlers.py
deleted file mode 100644 (file)
index d9726dd..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-import pickle
-from google.appengine.ext.webapp import RequestHandler, template
-from google.appengine.ext import db
-import tweepy
-
-from oauth_example.models import OAuthToken
-
-CONSUMER_KEY = 'e9n31I0z64dagq3WbErGvA'
-CONSUMER_SECRET = '9hwCupdAKV8EixeNdN3xrxL9RG3X3JTXI0Q520Oyolo'
-CALLBACK = 'http://127.0.0.1:8080/oauth/callback'
-
-# Main page handler  (/oauth/)
-class MainPage(RequestHandler):
-
-    def get(self):
-        # Build a new oauth handler and display authorization url to user.
-        auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET, CALLBACK)
-        try:
-            print template.render('oauth_example/main.html', {
-                    "authurl": auth.get_authorization_url(),
-                    "request_token": auth.request_token
-            })
-        except tweepy.TweepError, e:
-            # Failed to get a request token
-            print template.render('error.html', {'message': e})
-            return
-
-        # We must store the request token for later use in the callback page.
-        request_token = OAuthToken(
-                token_key = auth.request_token.key,
-                token_secret = auth.request_token.secret
-        )
-        request_token.put()
-
-# Callback page (/oauth/callback)
-class CallbackPage(RequestHandler):
-
-    def get(self):
-        oauth_token = self.request.get("oauth_token", None)
-        oauth_verifier = self.request.get("oauth_verifier", None)
-        if oauth_token is None:
-            # Invalid request!
-            print template.render('error.html', {
-                    'message': 'Missing required parameters!'
-            })
-            return
-
-        # Lookup the request token
-        request_token = OAuthToken.gql("WHERE token_key=:key", key=oauth_token).get()
-        if request_token is None:
-            # We do not seem to have this request token, show an error.
-            print template.render('error.html', {'message': 'Invalid token!'})
-            return
-
-        # Rebuild the auth handler
-        auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
-        auth.set_request_token(request_token.token_key, request_token.token_secret)
-
-        # Fetch the access token
-        try:
-            auth.get_access_token(oauth_verifier)
-        except tweepy.TweepError, e:
-            # Failed to get access token
-            print template.render('error.html', {'message': e})
-            return
-
-        # So now we could use this auth handler.
-        # Here we will just display the access token key&secret
-        print template.render('oauth_example/callback.html', {
-            'access_token': auth.access_token
-        })
-
diff --git a/examples/appengine/oauth_example/main.html b/examples/appengine/oauth_example/main.html
deleted file mode 100644 (file)
index 92ea389..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<html>
-
-    <head>
-        <title>Tweepy OAuth Example</title>
-    </head>
-
-    <body>
-        <h1>Tweepy OAuth Example</h1>
-        <h3><a href="{{authurl}}">Authorize Tweepy</a></h3>
-        <h3>Request token</h3>
-        <ul>
-            <li><b>Key:</b> {{request_token.key}}</li>
-            <li><b>Secret:</b> {{request_token.secret}}</li>
-        </ul>
-    </body>
-
-</html>
diff --git a/examples/appengine/oauth_example/models.py b/examples/appengine/oauth_example/models.py
deleted file mode 100644 (file)
index d76213b..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-from google.appengine.ext import db
-
-class OAuthToken(db.Model):
-    token_key = db.StringProperty(required=True)
-    token_secret = db.StringProperty(required=True)
-
diff --git a/examples/appengine/tweepy.zip b/examples/appengine/tweepy.zip
deleted file mode 100644 (file)
index 3666b25..0000000
Binary files a/examples/appengine/tweepy.zip and /dev/null differ
diff --git a/examples/bg.png b/examples/bg.png
deleted file mode 100644 (file)
index 1481768..0000000
Binary files a/examples/bg.png and /dev/null differ
diff --git a/examples/oauth/getaccesstoken.py b/examples/oauth/getaccesstoken.py
deleted file mode 100644 (file)
index 1453dd5..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-import webbrowser
-
-import tweepy
-
-"""
-    Query the user for their consumer key/secret
-    then attempt to fetch a valid access token.
-"""
-
-if __name__ == "__main__":
-
-    consumer_key = raw_input('Consumer key: ').strip()
-    consumer_secret = raw_input('Consumer secret: ').strip()
-    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
-
-    # Open authorization URL in browser
-    webbrowser.open(auth.get_authorization_url())
-
-    # Ask user for verifier pin
-    pin = raw_input('Verification pin number from twitter.com: ').strip()
-
-    # Get access token
-    token = auth.get_access_token(verifier=pin)
-
-    # Give user the access token
-    print 'Access token:'
-    print '  Key: %s' % token.key
-    print '  Secret: %s' % token.secret
-
diff --git a/examples/profile.png b/examples/profile.png
deleted file mode 100644 (file)
index 8e284d0..0000000
Binary files a/examples/profile.png and /dev/null differ