diff options
author | 2012-04-13 17:06:09 -0500 | |
---|---|---|
committer | 2012-04-16 13:36:39 -0500 | |
commit | 4ce1a90038b23d931858ad22815dbe29f74d7d98 (patch) | |
tree | 880428e5a6e23c472cfa14183884c0ac79bbf718 /pygithub3/services/git_data/commits.py | |
parent | :sparkles: Release 0.3 :sparkles: (diff) | |
download | python-github3-4ce1a90038b23d931858ad22815dbe29f74d7d98.tar.xz python-github3-4ce1a90038b23d931858ad22815dbe29f74d7d98.zip |
add Git Data API support
Diffstat (limited to 'pygithub3/services/git_data/commits.py')
-rw-r--r-- | pygithub3/services/git_data/commits.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/pygithub3/services/git_data/commits.py b/pygithub3/services/git_data/commits.py new file mode 100644 index 0000000..cdca300 --- /dev/null +++ b/pygithub3/services/git_data/commits.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 -*- + +from pygithub3.services.base import Service + + +class Commits(Service): + """Consume `Commits API <http://developer.github.com/v3/git/commits/>`_""" + + def get(self, sha, user=None, repo=None): + """get a commit from the current repo""" + request = self.make_request('git_data.commits.get', sha=sha, + user=user, repo=repo) + return self._get(request) + + def create(self, data, user=None, repo=None): + """create a commit on a repo + + :param dict data: Input. See `github commits doc`_ + :param str user: username + :param str repo: repository name + + """ + return self._post( + self.make_request('git_data.commits.create', user=user, repo=repo, + body=data) + ) + + |