{"id":16649930,"url":"https://github.com/datamine/twitter-banner-rotator","last_synced_at":"2025-06-14T13:05:13.765Z","repository":{"id":86599595,"uuid":"81420690","full_name":"Datamine/Twitter-Banner-Rotator","owner":"Datamine","description":"Updates your Twitter banner picture every 24 hours!","archived":false,"fork":false,"pushed_at":"2017-02-11T06:53:23.000Z","size":506,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-12T13:29:35.576Z","etag":null,"topics":["heroku","python","twitter"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Datamine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-09T07:07:41.000Z","updated_at":"2018-01-25T22:04:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"865d3fd6-77ad-455f-9620-9ecb3f7d1209","html_url":"https://github.com/Datamine/Twitter-Banner-Rotator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Datamine/Twitter-Banner-Rotator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Datamine%2FTwitter-Banner-Rotator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Datamine%2FTwitter-Banner-Rotator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Datamine%2FTwitter-Banner-Rotator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Datamine%2FTwitter-Banner-Rotator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Datamine","download_url":"https://codeload.github.com/Datamine/Twitter-Banner-Rotator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Datamine%2FTwitter-Banner-Rotator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259820812,"owners_count":22916548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["heroku","python","twitter"],"created_at":"2024-10-12T09:14:18.745Z","updated_at":"2025-06-14T13:05:13.739Z","avatar_url":"https://github.com/Datamine.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Twitter-Banner-Rotator\n\nThis project contains a Python script for updating your Twitter banner picture. By deploying this script (and a set of\nimages) to Heroku, and setting a scheduler to run the script once a day, your Twitter banner picture will get \nautomatically updated once a day --  selecting one at random from a set of images you provided.\n\n## Instructions \n\n0. Clone this repository: in your terminal, type `git clone https://github.com/Datamine/Twitter-Banner-Rotator` and `cd` into it.\n1. Go on [Heroku](www.heroku.com), make an account if necessary, and make a new app. \n    Your app has a URL. For example, on your app dashboard, if you hit `open app`, it'll take you to a website: \n    `https://example.herokuapp.com`. The part between the `https://` and `.herokuapp.com` is your app's name \n    (in this case, that's \"example\"). It's a unique identifier.\n2. Download the [Heroku Toolbelt](https://devcenter.heroku.com/articles/getting-started-with-python#set-up)\n    and log in on the terminal.\n3. In your local repository, type `heroku git:remote -a \u003cyour app name here\u003e`. \n    See [instructions](https://devcenter.heroku.com/articles/git#creating-a-heroku-remote) for adding a heroku remote\n    to your git repository.\n4. Back on the Heroku app dashboard, on app addons, add the `scheduler`. \n    Set it to schedule `python run.py` once a day. (Or hourly/every 10 minutes depending on the level of skittish pizzazz that you want.)\n3. Go on Twitter. [Make a new app](https://apps.twitter.com/) or use one that you've created previously. Obtain: \n    - `consumer_key`\n    - `consumer_secret` \n    - `access_token_key`\n    - `access_token_secret`\n4. On the Heroku Dashboard for your app, set four config variables for the credentials\n    obtained above. (It may be worth opening up the Python REPL and using the `twitter`\n    library to authenticate with those credentials, just to make sure that it works.\n    Note, as per `requirements.txt`, that this app uses the `python-twitter` library,\n    not the `twitter` library. You'll want to `pip install python-twitter`. If you run\n    into a naming conflict, I suggest you use a [virtual environment](http://docs.python-guide.org/en/latest/dev/virtualenvs/).)\n5. Download the pictures you like, and put them in the `Banners/` folder.\n6. To deploy your application to heroku, type:\n    \n    ```\n    git add .\n    git commit -m \"\u003cyour commit message here\u003e\"\n    git push heroku master\n    ```\n    \n7. You can then view the logs either on app dashboard, or using `heroku logs --app \u003cyour app name here\u003e --tail` from the command line.\n    Check the logs to make sure everyhing works as desired. \n\nI suggest changing your scheduled task's frequency to every 10 minutes in the start, so you can easily verify that it works,\nthen changing it to daily thereafter.\n\n## Extensions\n\nThe following are all quite straight-forwardly possible:\n\n- If you want to rotate among lots of images, you don't need to store them all\n    in a `Banners/` folder. That can get cumbersome. Instead, you can upload them\n    to an external image host, e.g. [imgur](www.imgur.com), and let some file, e.g. `banners_list.txt`\n    be a list of URLs to your banner images. Then you can use `urllib.urlretrieve`\n    to download the image to a temporary file, upload the file to Twitter, and \n    delete the file afterwards.\n\n- In line with the suggestion above, you could even randomly retrieve nice images\n    to use as backgrounds. I am reminded of Adam \n    Cadre's [stochastic planet](http://stochasticplanet.tumblr.com/)\n    project.\n\n## Issues \u0026 Notes\n\n- `.gif` files currently fail when you try to upload them. \n    This appears to be a problem in the `python-twitter` library.\n    See the [issue here](https://github.com/bear/python-twitter/issues/435).\n    You can correct this in the meantime by using ImageMagic to convert any gifs to jpg.\n\n- At first this script was written to cycle through a set of images. However, this relied on \n    the script being able to write to a file to denote the current position in the cycle,\n    which is not possible because Heroku's filesystem is read-only. I have been led\n    to believe that the best alternative is to attach a small database to store\n    that index, but this seems like a cumbersome solution, especially if I'm releasing\n    this as a tool for other people to use. It'd be better to migrate\n    the entire setup to AWS.\n\n- Since the script selects a banner from a set of pictures at random, it's currently\n    possible for the newly chosen banner to be the same as the one already in place.\n    This happens on an update with probability 1/n, where n is the number of pictures\n    in the `Banners` directory. There are some tricks that could be employed to\n    prevent this, but I've currently deemed this nonessential.\n\n-----\n\nYou can also read about this project on [my blog](http://johnloeber.com/docs/twitter-rotate.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatamine%2Ftwitter-banner-rotator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatamine%2Ftwitter-banner-rotator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatamine%2Ftwitter-banner-rotator/lists"}