Skip to content

Instantly share code, notes, and snippets.

@felipeborges
Created October 1, 2014 01:20
Show Gist options
  • Save felipeborges/73a828190ff356a78e3e to your computer and use it in GitHub Desktop.
Save felipeborges/73a828190ff356a78e3e to your computer and use it in GitHub Desktop.
A Twitter bot which replies how to refer properly to the computer operating system commonly called Linux.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
#
# Follow @gnu_police (https://twitter.com/gnu_police)
# https://github.com/bear/python-twitter
import twitter
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
ACCESS_TOKEN_KEY = ''
ACCESS_TOKEN_SECRET = ''
api = twitter.Api(consumer_key = CONSUMER_KEY,
consumer_secret = CONSUMER_SECRET,
access_token_key = ACCESS_TOKEN_KEY,
access_token_secret = ACCESS_TOKEN_SECRET)
statuses = api.GetSearch('Linux')
for status in statuses:
u = status.GetUser()
try:
api.PostUpdate("@%s YOU ACTUALLY MEANT GNU/LINUX!!" % u.GetScreenName(), in_reply_to_status_id = status.GetId())
except:
pass
with open(".gnu_police.log", "a") as log_file:
for status in statuses:
log_file.write("%s," % status.GetId())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment