Skip to main content

Create a tweet based on a #100DaysOfCode log message

Project description

LogTweet

Create a tweet based on a #100DaysOfCode log message.

Usage

The log url can be configured. The log has to have a format like my log, which you can find at https://log100days.lpld.io/log.md.

My log is based on the original #100DaysOfCode log repo. This is a markdown log. Have created a little Flask app that converts my log to an HTML site using the markdown2 package. But other Markdown converters should work similar.

Once you have an HTML document with h2 day headers and h3 sections for "Today's Progress" and "Link(s)", you can point the tool at that URL and generate a Tweet from it.

To actually enable the tweeting, you need to create a Twitter developer account and get an API key, API secret, Access Token and Access Token Secret. Also, because the tool creates shortened links via the Bit.ly service, you need an account there and an API key.

Options

If you want to create a tweet for a different day than today, you can do so with the --offset command line flag. The offset is defined in integer days relative to today. So to generate a tweet for yesterday use -o -1.

If you want to suppress the actual tweeting and only see the message in the console, use the --testmode command line flag.

Installation

I recommend pipx to install python scripts and other tools in isolated virtual environments. This keeps the you platform python clean and you don't have to worry about activating a particular virtual environment to use a tool/script.

pipx install logtweet

This way you will have a clean environment and the tool still available on the command line.

But if you want to, you should be able to install it with pip install logtweet.

Configuration

You need a configuration file for the script to work. The config.ini can either be in the current working directory or in ~/.config/logtweet/.

Because I can not figure out how to define a "post-install hook" that is run by pip I can not generate an example config at the defined location. You can find an example config on GitHub.

In that config file you define the URL where your log can be found and the API keys and access tokens that are needed for Twitter and Bit.ly.

Development

Install with

python -m pip install -e ".[develop]"

This installs the app dependencies as well as tools to develop and distribute the package.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

logtweet-0.1.1.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

logtweet-0.1.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file logtweet-0.1.1.tar.gz.

File metadata

  • Download URL: logtweet-0.1.1.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0

File hashes

Hashes for logtweet-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1647eea6e3b0128da730c1c7f0e1368ab41ba2e4e56bc1882578ee7ffce425c3
MD5 30bc8cf71c1c9f5d23b450fbbad1ceee
BLAKE2b-256 70845fa62d78e833de31b92479ed7e1bce3c877c99f101e0273569d8f5512177

See more details on using hashes here.

File details

Details for the file logtweet-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: logtweet-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0

File hashes

Hashes for logtweet-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5e7fa57315bbe879665ba1166e8227da0fa680c4f40d610115d0cab1623ba614
MD5 3d1d1cb7977e46005dc6661dec54867d
BLAKE2b-256 095c3e3966b78bfdcf9748972c40299d25af80fdd11b32a2d408d3a86a0010ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page