Skip to content
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

randimgbot

Build Status Python: 3.5+ Code style: black

Pick a random image and tweet it.

Example

Randimgbot powers @FlagFacts.

Set up

Create and authorise an app with (read and) write access at:

https://dev.twitter.com/apps/new

Store credentials in YAML file. See data/randimgbot_example.yaml.

Install dependencies:

pip install -r requirements.txt

Run it

Call something like:

python randimgbot.py -y path/to/randimgbot.yaml -i path/to/dir/full/of/images/*.jpg -t "Random thing: {0} #randomthing {1}"

Where {0} will be replaced with a name taken from the filename, and {1} is a hashtag from the name. Either or both can be omitted.

Alternatively with a JSON file:

python randimgbot.py -y path/to/randimgbot.yaml -i data/randimgbot_example.json -t "Random thing: {0} #randomthing {1}"

Where the JSON file looks something like data/randimgbot_example.json:

{
  "image1.jpg": "Description 1",
  "image2.jpg": "Description 2\nLine 2"
}

By default it will only tweet randomly 1/12 times. Change this denominator with --chance.

Check full options with:

python randimgbot.py -h

About

Pick a random image and tweet it

Topics

Resources

Releases

No releases published

Sponsor this project

 
Learn more about GitHub Sponsors
You can’t perform that action at this time.