I am working on an app that basically shows content from a website, in a native app. To do this, I wrote a python script that scrapes the page for content, and then inserts records into the database. I didn't want to mess with a sms gateway or email server to notify me when it's found changes in the original page, so I decided to make the script post to twitter when it updates.
Following this page with few modifications, I was able to get this working with Python 3 and tweepy1.4.
This is what the code to get the pin looks like, two things that changed in python from 2 to 3 is 'raw_input' becomes 'input' and print behaves like a regular function requiring parentheses.
# python code
CONSUMER_KEY = 'key here'
CONSUMER_SECRET = 'secret here'
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth_url = auth.get_authorization_url()
print('Please authorize: ' + auth_url)
verifier = input('PIN: ').strip()
print("ACCESS_KEY = '%s'" % auth.access_token.key)
print("ACCESS_SECRET = '%s'" % auth.access_token.secret)
From here you should have no problem following Jeff Millers blog post.
@kpfsoftware is where the bot posts, hopefully i'll have the app in the market in the next few days.
And there you have it, a twitter bot using Python 3.
Saturday, January 8, 2011
Created a super simple discount calculator, first app with AdMob ads.
- Extra large text
- Numeric input (uses your keyboard)
- Keyboard hides when clicking 'find price'
Get it from the market, visit here on your Android browser or use the barcode below.
Sunday, January 2, 2011
Archery Tool has been updated, all user experience upgrades. Custom title bar, and the kinetic energy section now has more information visible on the screen. Over 850 downloads!!!
Visit here on your android browser or use a barcode scanner.
Posted by KPF Software at 8:07 PM