csesoc/bark-client-python — pull request #1 by evgenymartynov (2013-02-19 04:34:43+00:00)
Title: Basic BarkClient, basic persistence

`bark.client` is the client library for interaction with the Bark API.

`single-swipe.py` is a demo of how it can be used.

### Persistence

Currently using `~/.bark-client/dev/swipes` for persistence -- take a look at `bark.client.lib` and see if you can spot anything that may fail. We should avoid clobbering the file, preferring failed writes over corrupted data.

I chucked a couple of FS-level locks on it, too, just in case (StackOverflow seems to say that O_APPEND is atomic with small <4KB writes).
To test them, open 2 terminals: one for `single-swipe.py` (don't run it yet), and the other with
```
(
flock 200
cat
) 200>~/.bark-client/dev/swipes
```
Then run the demo, and it should block. Doing a `^D` into the `cat` terminal should un-block it, and the write will go through.

### Next up

I will add swipe uploading soon. It will use `auth_token` instead of event codes.