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 'travispy' >>> user['login'] 'travispy'
To get the list of repositories that you are member of:
>>> repos = t.repos(member=user.login) >>> len(repos) # Ordered by recent activity 5 >>> repos <travispy.entities.repo.Repo object at 0x02C26C49> >>> repos.slug 'travispy/on_py34'
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 = t.build(repo.last_build_id) >>> build <travispy.entities.build.Build object at 0x02C26C50> >>> build.restart() True >>> build.cancel() True >>> build.cancel() # As build was already cancelled it will return False. False