A Twitter bot developed in Python using the Tweepy library and hosted in AWS.

Overview

Twitter Cameroon: @atangana_aron

A Twitter bot developed in Python using the Tweepy library and hosted in AWS. https://twitter.com/atangana_aron

Cost = Free!

The Bot

Yaounde (Image)

This bot will get a large sample of tweets with the word Yaoundé and then retweet the most liked tweet from the sample with an attached photo. (At present this runs only on Sundays)

Paul Biya Alert

This bot will run daily and check to see if there is an abnormally large number of relevant Tweets and then retweet the most liked tweet (if there are a lot of Tweets that day). The bot will specifically pull tweets with the word Biya and see how many of them also contain Paul.

Top 10 Words

This bot will pull a large sample of tweets with the word Cameroun (French spelling of Cameroon). For each Tweet, it removes stopwords and duplicates, then creates a bag of words counting occurrence of each word. The top 10 words are then tweeted. (At present, this runs every day except Sunday)

AWS Hosting

AWS Lambda

Lambda functions have many uses. In this case, we will use it for ultra cheap (free) hosting/computing. All work necessary in AWS to run this bot is done by navigating to Lambda in the AWS UI and creating a new function. The equivalent of main.py for a lambda function is lambda_function.py. To observe the code, start with lambda_function.py and trace its references.

Non-native Python Packages w/ Lambda

The bot relies on a non-native package (in this case Tweepy). Running the code on Lambda requires also uploading the package. This can be done in several ways, as outlined here: https://docs.aws.amazon.com/lambda/latest/dg/python-package.html

Cloudwatch Events

These are the triggers that will determine when to run your lambda function. Using cron expressions, you can set this on a schedule to run at a certain time per day, day per week/month.

Twitter API

Developer API

https://developer.twitter.com/en/docs/twitter-api

Tweepy

https://www.tweepy.org/

A few highlights:

  • Max # of tweets pulled at once is 3200
  • Can both download tweets and create tweets

Running this code

API Keys

Requires your own APIKeys.py in the API folder. Generate these from the Twitter Developer API. After signing up for a developer account, create a new project and generate read/write keys. Format of APIKeys.py should be as follows:

  • Key = 'xxx'
  • Secret = 'yyy'
  • Bearer_Token = 'zzz'
  • Access_Token = '111'
  • Access_Secret = '222'

AWS

Everything in this code runs using the free tiers of AWS. You'll need to create your own account which requires attaching a valid credit card. You'll need to create the lambda function, upload the code as a zip, attach the trigger (Cloudwatch Event), and change the runtime to allow for ~30 seconds or less. You'll need to follow the instructions under the AWS Hosting section of this readme to upload the script with the necessary package, otherwise you'll receive an error stating Tweepy: no such module.

Cost

Twitter's API has a limit of number of tweets per month (using the free version). At the time of this writing, that limit is >150x the Tweepy API call limit.

AWS Lambda has a monthly compute free tier. Each run of a bot is <.1% of that limit at the time of this writing.

Owner
master's student in data science at Georgia Tech
Python + AWS Lambda Hands OnPython + AWS Lambda Hands On

Python + AWS Lambda Hands On Python Criada em 1990, por Guido Van Rossum. "Bala de prata" (quase). Muito utilizado em: Automatizações - Selenium, Beau

Marcelo Ortiz de Santana 8 Sep 09, 2022
Instagram - Instagram Account Reporting Tool

Instagram Instagram Account Reporting Tool Installation On Termux $ apt update $

Aryan 6 Nov 18, 2022
A telegram media to gofile bot

GoFile-Bot A telegram media to gofile bot Made with Python3 (C) @FayasNoushad Copyright permission under MIT License License - https://github.com/Fay

Fayas Noushad 37 Nov 14, 2022
Telegram Link Shortener Bot (With 20 Shorteners)

Telegram ShortenerBot ShortenerBot: 🇬🇧 Telegram Link Shortener Bot (11 + 9 Shorteners) 🇹🇷 Telegram Link Kısaltıcı Bot (11 + 9 Kısaltıcı) All suppo

Hüzünlü Artemis [HuzunluArtemis] 10 May 24, 2022
This is a small Messnger with the cmd as an interface

Messenger This is a small messenger with the cmd as an interface. It started as a project to learn more about Python 3. If you want to run a version o

1 Feb 24, 2022
Yes, it's true :orange_heart: This repository has 346 stars.

Yes, it's true! Inspired by a similar repository from @RealPeha, but implemented using a webhook on AWS Lambda and API Gateway, so it's serverless! If

512 Jan 01, 2023
A simple telegram Bot, Upload Media File| video To telegram using the direct download link. (youtube, Mediafire, google drive, mega drive, etc)

URL-Uploader (Bot) A Bot Upload file|video To Telegram using given Links. Features: 👉 Only Auth Users (AUTH_USERS) Can Use The Bot 👉 Upload YTDL Sup

Hash Minner 18 Dec 17, 2022
Telegram tools

Telegram-Tools Telegram tools. Explanation English | 中文 Features Export group memebrs Add users to the group Send message to users Setup API Open http

4 Apr 02, 2022
Kanata Bot - a modular bot running on python3 with anime theme and have a lot features

Kanata Bot Kanata Bot is a modular bot running on python3 with anime theme and have a lot features. Easiest Way To Deploy On Heroku This Bot is Create

Rikka-Chan 2 Jan 16, 2022
A discord bot for checking what linked profiles a user has to their Ubisoft account

ubisoft_discord_profiles A Discord bot for checking what linked profiles a user has to their Ubisoft account. This can be setup using an enviromental

Andrei 1 Dec 17, 2021
Find the best repos to contribute to, right from Discord!

repo-finder-bot Find the best repos to contribute to, right from Discord! Add to your server FAQs Hmm. What's this? This is the Repo Finder Bot, a bot

Skyascii 61 Dec 25, 2022
Cogs for Red-DiscordBot

Redbot cogs for Red-DiscordBot authored by Kreusada This is my repository for Red Discord-Bot. I built these cogs because these were the features that

Kreus Amredes 26 Nov 07, 2022
This is a simple bot that can be used to upload images to a third-party cloud (image hosting). Currently, only the imgbb.com website supports the bot. I Will do future updates

TGImageHosting This is a simple bot that can be used to upload images to a third party cloud (image hosting). Currently, only the imgbb.com website su

Abhijith N T 0 Dec 26, 2021
A Python interface to AFL, allowing for easy injection of testcases and other functionality.

Fuzzer This module provides a Python wrapper for interacting with AFL (American Fuzzy Lop: http://lcamtuf.coredump.cx/afl/). It supports starting an A

Shellphish 614 Dec 26, 2022
A Python Program to determine Degree of Profanity of Tweets

tweetx tweetx is a program to detect racial slurs in Twitter Tweets. Racial Abuse on Twitter is becoming quite a serious issue in recent times. tweetx

Kartik Poojari 3 Nov 11, 2021
My Discord Bot that I used to learn Python. Please disregard the unstructured code!

Botsche My personal Discord Bot. To run this bot, change TOKEN in config.ini to your Discord Bot Token, which can be retrieved from your Discord Dev

Mats Voss 1 Nov 29, 2021
The Research PACS on AWS solution facilitates researchers' access medical images stored in the clinical PACS in a secure and seamless manner

Research PACS on AWS Challenge to solve Solution presentation Deploy the solution Further reading Releases License Challenge to solve The rise of new

AWS Samples 23 Sep 09, 2022
Financial portfolio optimisation in python, including classical efficient frontier, Black-Litterman, Hierarchical Risk Parity

PyPortfolioOpt has recently been published in the Journal of Open Source Software 🎉 PyPortfolioOpt is a library that implements portfolio optimizatio

Robert Martin 3.2k Jan 02, 2023
Análise de dados abertos do programa Taxigov.

Análise de dados do Taxigov Este repositório contém os cadernos Jupyter usados no projeto de análise de dados do Taxigov. Conjunto de dados O conjunto

Augusto Herrmann 1 Jan 10, 2022
Nowadays we don't have time to listen to each and every song that we come across in a playlist.

Nowadays we don't have time to listen to each and every song that we come across in a playlist. so, this project helps you. we used Spotify API for collecting the dataset information and able to do E

3 Apr 26, 2022