Skip to content

Instantly share code, notes, and snippets.

@excid3
Created May 28, 2010 03:16
Show Gist options
  • Save excid3/416690 to your computer and use it in GitHub Desktop.
Save excid3/416690 to your computer and use it in GitHub Desktop.
#!/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__ = 'tom@spylogic.net'
__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