thricedotted/twitterbot — pull request #1 by aanand (2014-06-29 11:14:40+00:00)
Title: Configurable storage

Move the filesystem-specific parts of state loading/saving into a separate class - FileStorage - which can be swapped out for anything which implements the primitives `read(name)` and `write(name)`, both of which return an IO-like object (for reading or writing, respectively).

I've written a [backend which uses SQLAlchemy](https://gist.github.com/aanand/6188b0b09227aeadc86a) and can be used as a drop-in replacement when running a bot on Heroku:

```python
self.config['storage'] = SQLStorage(os.environ['DATABASE_URL'])
```