"""
Example program for the Stream API. This prints public status messages
from the "sample" stream as fast as possible.

USAGE

  twitter-stream-example <username> <password>

"""

from __future__ import print_function

import sys

from .stream import TwitterStream
from .auth import UserPassAuth
from .util import printNicely

def main(args=sys.argv[1:]):
    if not args[1:]:
        print(__doc__)
        return 1

    # When using twitter stream you must authorize. UserPass or OAuth.
    stream = TwitterStream(auth=UserPassAuth(args[0], args[1]))

    # Iterate over the sample stream.
    tweet_iter = stream.statuses.sample()
    for tweet in tweet_iter:
        # You must test that your tweet has text. It might be a delete
        # or data message.
        if tweet.get('text'):
            printNicely(tweet['text'])

@@ -128,16 +128,8 @@
 %0A%0A  
-twitter-
 stre
@@ -143,28 +143,77 @@
 ple 
-%3Cusername%3E %3Cpassword
+-t %3Ctoken%3E -ts %3Ctoken_secret%3E -ck %3Cconsumer_key%3E -cs %3Cconsumer_secret
 %3E%0A%0A%22
@@ -266,18 +266,30 @@
 ort 
-sys%0A%0Afrom 
+argparse%0A%0Afrom twitter
 .str
@@ -318,17 +318,25 @@
 am%0Afrom 
-.
+twitter.o
 auth imp
@@ -339,24 +339,17 @@
  import 
-UserPass
+O
 Auth%0Afro
@@ -350,16 +350,23 @@
 th%0Afrom 
+twitter
 .util im
@@ -387,97 +387,509 @@
 ly%0A%0A
+%0A
 def 
-main(args=sys.argv%5B1:%5D):%0A    if not args%5B1:%5D:%0A        print(__doc__)%0A        return 1
+parse_arguments():%0A%0A    parser = argparse.ArgumentParser()%0A%0A    parser.add_argument('-t',  '--token', help='The Twitter Access Token.')%0A    parser.add_argument('-ts', '--token_secret', help='The Twitter Access Token Secret.')%0A    parser.add_argument('-ck', '--consumer_key', help='The Twitter Consumer Key.')%0A    parser.add_argument('-cs', '--consumer_secret', help='The Twitter Consumer Secret.')%0A%0A    return parser.parse_args()%0A%0A##  parse_arguments()%0A%0A%0Adef main():%0A%0A    args = parse_arguments()
 %0A%0A  
@@ -941,27 +941,8 @@
 ize.
- UserPass or OAuth.
 %0A   
@@ -974,37 +974,84 @@
 uth=
-UserPassAuth(args%5B0%5D, args%5B1%5D
+OAuth(args.token, args.token_secret, args.consumer_key, args.consumer_secret
 ))%0A%0A
@@ -1326,8 +1326,59 @@
 text'%5D)%0A
+%0A##  main()%0A%0Aif __name__ == '__main__':%0A    main()%0A

Update to use OAuth, take in command line arguments and modify the imports to function from within the module.