Kitovu is a thin layer around the GitHub API. You still have to construct URI
paths yourself. The primary benefit is automatically setting your
Authorization
header based on a token in a config file. There is also a
useful get_all
method that automatically handles pagination.
Kitovu can be used in several different ways.
You can use kitovu with no configuration file. The calls are unauthenticated, which limits which calls you can make as well as imposing stricter rate limits.
>>> api = kitovu.Api()
Kitovu can read a yaml configuration file where you can define your personal access token. Users of GitHub Enterprise will also need to set a custom api endpoint.
token: 0101010101010101010101010101010101010101
hub: https://github.example.com/api/v3
This configuration file can be defined in one of two ways.
>>> api = kitovu.Api(config='/etc/public.yaml')
You can tell kitovu to search for a profile in a standard location on your
system, which is determined by the appdirs module. For example, the
profile "public" will cause kitovu to try to load the file
/home/username/.config/kitovu/public.yaml
.
>>> api = kitovu.Api(profile='public')
Once you setup your api object, all API calls should be available to you.
>>> api.get('/user/repos')
>>> payload = {'tag_name': 'v1.0.0'}
>>> api.post('/repos/username/myrepo/releases', payload)