diff options
author | 2011-11-09 10:01:49 -0800 | |
---|---|---|
committer | 2011-11-09 10:01:49 -0800 | |
commit | 2440c2c98897f87dfefd8f2cdf14d888c21f5986 (patch) | |
tree | 142ac0b492d38869602c48468553a0c2c169eaf4 /github3/handlers/gists.py | |
parent | Fixing bugs. Crazy night :S (diff) | |
parent | Updated example in README.rst to work with current version (diff) | |
download | python-github3-2440c2c98897f87dfefd8f2cdf14d888c21f5986.tar.xz python-github3-2440c2c98897f87dfefd8f2cdf14d888c21f5986.zip |
Merge pull request #2 from akaihola/gists
Gist handler and init tests
Diffstat (limited to 'github3/handlers/gists.py')
-rw-r--r-- | github3/handlers/gists.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/github3/handlers/gists.py b/github3/handlers/gists.py new file mode 100644 index 0000000..15f215c --- /dev/null +++ b/github3/handlers/gists.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 -*- +# +# author: Antti Kaihola + +from .base import Handler +from .. import models + + +class Gist(Handler): + """ Gist handler """ + + prefix = 'gists' + + def __repr__(self): + return '<Gist handler>' + + def get(self, gist_id): + """ Return gist """ + + return self._get_resource(gist_id, model=models.Gist) + + def create_gist(self, description, public=True, files={}): + """ Create a gist """ + data = {'description': description, + 'public': public, + 'files': files} + return self._post_resource('', data=data, model=models.Gist) |