Created
May 28, 2010 03:16
-
-
Save excid3/416690 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
# Filename: notabot.py | |
# Version 1.0 | |
# This is a simple Twitter bot that updates status with a random funny statement from a file called "quote" | |
# More bots at socialnetworkbots.com | |
"""A bot that sends random stuff to Twitter.""" | |
__author__ = '[email protected]' | |
__version__ = '1.0' | |
import os | |
import sys | |
import random | |
import twitter | |
import time | |
# Optional endless loop. Use cron instead! | |
# while True: | |
file = open("quote", "r") | |
lines = file.read().splitlines() | |
file.close() | |
line = lines[0] | |
print "Posting random nonsense to Twitter...standby!" | |
api = twitter.Api(username='USERNAME',password='PASSWORD') | |
api.PostUpdate(line) | |
print "I Tweeted!" | |
file = open("quote", "w") | |
file.writelines(lines[1:]) | |
file.close() | |
# Wait 2 minutes | |
# print "Waiting 2 minutes..." | |
# time.sleep(120) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment