Giter VIP home page Giter VIP logo

dailywikiart's Introduction

dailywikiart Twitter Bot

dailywikiart is a simple Twitter bot that tweets random high-resolution works of art from wikiart's API. Each tweet includes a thumbnail, description of the work, and a link to the original image.

See it in the wild running off heroku: @dailywikiart

Features

  • Randomized selection of high resolution art images.
  • MongoDB database ensures that an image is never tweeted more than once.

Requirements

  • Python 3.6+
  • running mongodb instance

Installation

$ git clone [email protected]:kylepw/dailywikiart.git && cd dailywikiart
$ python -m venv venv && source venv/bin/activate
(venv) $ pip install -r requirements.txt

Setup

  • Create a Twitter application with the Twitter account you wish to use with the bot. Make sure you set Read and Write access and jot down these values: consumer key, consumer secret, access token, and access token secret.
  • Set the required environment variables as follows:

    API_KEY

    Your application's consumer key.

    API_SECRET

    Your application's secret key.

    ACCESS_TOKEN

    Your access token.

    ACCESS_SECRET

    Your access token secret.

    MONGODB_URI

    Your mongodb URI

    MONGODB_DBNAME

    Database name

    You can use python-dotenv, pipenv, virtualenv or bash to set the environment variables.

    One way to do it (replacing XXX's with your values):

    $ echo -e "API_KEY=XXX\nAPI_SECRET=XXX\nACCESS_TOKEN=XXX\nACCESS_SECRET=XXX\nMONGODB_URI=XXX\nMONGODB_DBNAME=XXX" >> .env
    $ set -a; source .env; set +a
    

Usage

(venv) $ # Make sure virtual environment is active
(venv) $ # and you have a mongodb instance running
(venv) $ python bot.py

or to view logs:

(venv) $ LOGLEVEL=info python bot.py

Scheduling

You could run this bot at a set time using any scheduler such as crontab, systemd, or launchd.

This bot is currently running on heroku with a mongodb add-on and clock dyno.

License

MIT License

dailywikiart's People

Contributors

kylepw avatar dependabot[bot] avatar

Stargazers

nonfunjible avatar  avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.