Code Monkey home page Code Monkey logo

microblog.py's Introduction

microblog.py A Command-Line Microblogging Client

I wanted a simple command-line client for twitter/identica/statusnet. microblog.py's commands are quite similar to twidge's. It's implemented using python-twitter.

Usage: microblog.py [options] command [args]

A Few Example Commands

First, setup an alias mb for microblog.py. Then:

Spy on the identica public timeline:

$ mb lspublic

Print only messages that haven't been printed before:

$ mb -u lspublic

Spy on the twitter public timeline:

$ mb -a twitter lspublic

You don't need an identica or twitter account to do this!

List unseen messages from you and your friends:

$ mb -u lspersonal

List replies to you:

$ mb lsreplies

Search identica for mentions of 'python':

$ mb search python

Search for mentions of your username:

$ mb lsmentions

Post a new message to your microblog:

$ mb send

You don't have to type a command name in full, you can just type a unique prefix. For example, 'lsc' for the 'lscommands' command, 'lsr' for the 'lsreplies' command, etc.

To print a short list of the available commands:

$ mb lscommands

If you don't want to keep typing your username and password you can put them in a ~/.microblogrc file:

[DEFAULT]
# Use twitter instead of identica by default.
apiroot = twitter
# Specify a default for the --encoding option.
encoding = UTF-8
# Always use the --unseen option.
unseen = True

[identica]
username = seanh
password = **********

[twitter]
username = your_username
password = *****

To print the detailed help message:

$ mb -h

microblog.py is suitable for shell scripting. For example, to watch the public timeline ticking by live:

$ while (true); do mb -u lspublic; sleep 10; done

...or to watch only message to do with recipes:

$ while (true); do mb -u search recipes; sleep 10; done

TODO

I've taken microblog.py about as far as I'm likely to. I just wanted a simple microblogging command, and this fits my needs. But there's much that could be added:

  • Add --no-colour option. (To implement this, if NOCOLOUR is True then just set all the colour escape codes (BLACK, RED, GREEN, etc.) to empty strings.
  • Add --no-bold option. (Same implementation as --no-colour.)
  • Add --no-wrap option.
  • Implement show <id> command to show specific message(s) by id.
  • Short-format printing of messages and users should be tab-separated values with empty lines separating rows. \n's will appear in values because the output is hard-wrapped, but an empty line (\n\n) indicates a new row. Will have to replace any tab characters in values with four spaces.
  • Long-format printing of messages and users should be JSON.
  • microblog.py should be able to parse its own output as input so that you can, for example, copy messages from a twitter account to an identica accout by piping the stdout of one microblog.py command to the stdin of another.
  • Make it installable with distutils.
  • Finish implementing the commands that currently raise NotImplementedError.
  • Add more error handling, e.g. of HTTPErrors raised by python_twitter.
  • Add an interactive mode, probably using curses: microblog.py --interactive.

If you feel like contributing, fork it!

microblog.py's People

Watchers

 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.