Initial commit of my old Twitter bot (that still runs)

This commit is contained in:
Amber McCloughan 2022-08-26 05:22:51 +00:00
commit 23422f0ffd
9 changed files with 513 additions and 0 deletions

255
.gitignore vendored Normal file
View File

@ -0,0 +1,255 @@
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# ---> VisualStudioCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# ---> JetBrains
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
# ---> macOS
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM python:3.10-alpine
WORKDIR /app
ENV PYTHONIOENCODING=utf-8
COPY Pipfile Pipfile.lock everybody.txt tweetbot.py /app
# Install pipenv and compilation dependencies
RUN pip install pipenv && pipenv install --deploy --ignore-pipfile
# Run the application
ENTRYPOINT ["pipenv", "run", "python3", "./tweetbot.py"]

9
LICENSE Normal file
View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

13
Pipfile Normal file
View File

@ -0,0 +1,13 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
tweepy = "==4.10.1"
[dev-packages]
autopep8 = "==1.7.0"
[requires]
python_version = "3.10"

110
Pipfile.lock generated Normal file
View File

@ -0,0 +1,110 @@
{
"_meta": {
"hash": {
"sha256": "a94545d640dcc28fce0a26b5d40dfaebf886910d87df38ab7bbe4ab7ec69f066"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.10"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"certifi": {
"hashes": [
"sha256:84c85a9078b11105f04f3036a9482ae10e4621616db313fe045dd24743a0820d",
"sha256:fe86415d55e84719d75f8b69414f6438ac3547d2078ab91b67e779ef69378412"
],
"markers": "python_version >= '3.6'",
"version": "==2022.6.15"
},
"charset-normalizer": {
"hashes": [
"sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845",
"sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f"
],
"markers": "python_version >= '3.6'",
"version": "==2.1.1"
},
"idna": {
"hashes": [
"sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff",
"sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"
],
"markers": "python_version >= '3.5'",
"version": "==3.3"
},
"oauthlib": {
"hashes": [
"sha256:23a8208d75b902797ea29fd31fa80a15ed9dc2c6c16fe73f5d346f83f6fa27a2",
"sha256:6db33440354787f9b7f3a6dbd4febf5d0f93758354060e802f6c06cb493022fe"
],
"markers": "python_version >= '3.6'",
"version": "==3.2.0"
},
"requests": {
"hashes": [
"sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983",
"sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349"
],
"markers": "python_version >= '3.7' and python_version < '4'",
"version": "==2.28.1"
},
"requests-oauthlib": {
"hashes": [
"sha256:2577c501a2fb8d05a304c09d090d6e47c306fef15809d102b327cf8364bddab5",
"sha256:75beac4a47881eeb94d5ea5d6ad31ef88856affe2332b9aafb52c6452ccf0d7a"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==1.3.1"
},
"tweepy": {
"hashes": [
"sha256:0a21396b646af4fcee69762d2908c104e1fe2e2c4e1dfd6e6078a41b38771382",
"sha256:310193775d7fc381abd6f37021a9af27f7e9edfcce5ec51bd73ea5f30c21fa61"
],
"index": "pypi",
"version": "==4.10.1"
},
"urllib3": {
"hashes": [
"sha256:3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e",
"sha256:b930dd878d5a8afb066a637fbb35144fe7901e3b209d1cd4f524bd0e9deee997"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' and python_version < '4'",
"version": "==1.26.12"
}
},
"develop": {
"autopep8": {
"hashes": [
"sha256:6f09e90a2be784317e84dc1add17ebfc7abe3924239957a37e5040e27d812087",
"sha256:ca9b1a83e53a7fad65d731dc7a2a2d50aa48f43850407c59f6a1a306c4201142"
],
"index": "pypi",
"version": "==1.7.0"
},
"pycodestyle": {
"hashes": [
"sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785",
"sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b"
],
"markers": "python_version >= '3.6'",
"version": "==2.9.1"
},
"toml": {
"hashes": [
"sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b",
"sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"
],
"markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==0.10.2"
}
}
}

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# everybodymov

30
everybody.txt Normal file
View File

@ -0,0 +1,30 @@
I can see right through you and I find myself oddly excited.
You glow deep inside like a nightlight. I wish to be warmed by this light.
The colors change so rapidly I can hardly focus my eyes. I must crawl inside you at once.
And your ass is like a peach, like a peach ass.
Stop staring all of you. There won't be enough room for you to climb in; I am too small in the necessary spaces.
Your gaze fills me with deep shame.
Feverish sensations fill my blood from matters of a violent and unfulfilled desire. I am swollen with sickness.
You are made of beets. I think this is wonderful. You are made of beets. I think this is wonderful.
I wished for her to remove them one by one with her mouth.
It would cause a hemorrhage, of this I am certain.
When she is not around I do not exist at all.
A pathological disorder, let's be honest.
In my dreams there is an intimacy I have never known.
These newfound discoveries are causing me to spray strange oily liquids.
When I wake up, I feel profound disappointment and humiliation.
You are too needy, dripping with need. You should probably kill yourself before someone drowns in your seepage.
You paralyze me with disgust. You are spilling open like a gelatinous urchin belly.
I am aware of this. Please tell me how I can make myself appear more desirable to others. I would like to know my surgical options.
I hate you.
I would like to end your life - but why? I know: meat. You are nothing but meat. You smell like diapers and sausage.
I disagree. Your waxy face looks ashen like a cadaverous larva, but I am enamoured with your smell, like a cranal flower with a frankincense opening, steeped in the essence of leather and mimosa.
You are a delight. If only I could remove your head altogether.
I will perform the surgery at once. I hope you are not too sensitive to pain.
I will elect to have the surgery, too. There is someone particular I have in mind whom I would like to impress. So far, nothing else is working.
What is this burning sensation? It is all encompassing. As if there are holes everywhere, all over me.
Burning sensations. Burning sensations.
I cannot make sense of all this slime. You are so slimy. Might I run my tongue along this substance?
Perhaps I will move underground like a subterranean alien.
I will visit and bring gifts to soothe your decaying limbs which will be crushed by the weight of the earth on top of your body.
I will also apply my saliva technique to your rotten spots. No problem at all.

9
requirements.txt Normal file
View File

@ -0,0 +1,9 @@
-i https://pypi.org/simple
certifi==2022.6.15; python_version >= '3.6'
charset-normalizer==2.1.1; python_version >= '3.6'
idna==3.3; python_version >= '3.5'
oauthlib==3.2.0; python_version >= '3.6'
requests==2.28.1; python_version >= '3.7' and python_version < '4'
requests-oauthlib==1.3.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
tweepy==4.10.1
urllib3==1.26.12; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' and python_version < '4'

73
tweetbot.py Normal file
View File

@ -0,0 +1,73 @@
#!/usr/bin/env python3
import os
import sys
from typing import Tuple
import tweepy
from time import sleep
from random import shuffle
def get_arguments() -> Tuple[str, str, str, str]:
consumer_key = os.environ['CONSUMER_KEY']
consumer_secret = os.environ['CONSUMER_SECRET']
access_token = os.environ['ACCESS_TOKEN']
access_token_secret = os.environ['ACCESS_TOKEN_SECRET']
return consumer_key, consumer_secret, access_token, access_token_secret
def populate_array(file_lines) -> list:
length = len(file_lines)
array = []
for i in range(length):
array.append(i)
shuffle(array)
return array
def main() -> None:
# Access and authorize our Twitter credentials
consumer_key, consumer_secret, access_token, access_token_secret = get_arguments()
auth = tweepy.OAuth1UserHandler(consumer_key=consumer_key, consumer_secret=consumer_secret,
access_token=access_token, access_token_secret=access_token_secret)
api = tweepy.API(auth=auth)
my_file = open('./everybody.txt', 'r', encoding='utf-8')
# Read lines one by one from my_file and assign to file_lines variable
file_lines = [x.strip() for x in my_file.readlines()]
# Close file.
my_file.close()
array = populate_array(file_lines)
# Driving loop.
while True:
while array:
tweet = file_lines[array.pop()]
try:
print(tweet)
api.update_status(tweet)
sleep(1800)
except tweepy.Forbidden as fe:
print(f"{fe.api_errors}")
sleep(30)
except tweepy.BadRequest as be:
print(f"{be.api_errors}")
sys.exit(1)
except tweepy.TweepyException as te:
print(te)
sys.exit(1)
array = populate_array(file_lines)
if __name__ == '__main__':
main()