Getting startedΒΆ

TravisPy works just as Travis CI: it authenticates against GitHub. So as a requirement you must have a GitHub access token with the following scopes:

  • read:org
  • user:email
  • repo_deployment
  • repo:status
  • write:repo_hook

With your token in hands all is easy:

>>> from travispy import TravisPy
>>> t = TravisPy.github_auth(<your_github_token>)
>>> user = t.user()
>>> user
<travispy.entities.user.User object at 0x02C26C48>

Now you can access information related to user current logged in:

>>> user.login
>>> user['login']

To get the list of repositories that you are member of:

>>> repos = t.repos(member=user.login)
>>> len(repos) # Ordered by recent activity
>>> repos[0]
<travispy.entities.repo.Repo object at 0x02C26C49>
>>> repos[0].slug

Or simply request for repository you want:

>>> repo = t.repo('travispy/on_py34')
<travispy.entities.repo.Repo object at 0x02C26C51>

And finally, getting build information:

>>> build =
>>> build
< object at 0x02C26C50>
>>> build.restart()
>>> build.cancel()
>>> build.cancel() # As build was already cancelled it will return False.

Please refer to the official API to learn more about which entities are supported. Soon a specific and detailed documentation related to this library will be available.