diff --git a/docs/_build/doctrees/api.doctree b/docs/_build/doctrees/api.doctree new file mode 100644 index 0000000..2c6ff6a Binary files /dev/null and b/docs/_build/doctrees/api.doctree differ diff --git a/docs/_build/doctrees/entities.doctree b/docs/_build/doctrees/entities.doctree new file mode 100644 index 0000000..6c5d5f5 Binary files /dev/null and b/docs/_build/doctrees/entities.doctree differ diff --git a/docs/_build/doctrees/environment.pickle b/docs/_build/doctrees/environment.pickle index 661f9f5..3186e47 100644 Binary files a/docs/_build/doctrees/environment.pickle and b/docs/_build/doctrees/environment.pickle differ diff --git a/docs/_build/doctrees/getting_started.doctree b/docs/_build/doctrees/getting_started.doctree new file mode 100644 index 0000000..ccf5bb9 Binary files /dev/null and b/docs/_build/doctrees/getting_started.doctree differ diff --git a/docs/_build/doctrees/index.doctree b/docs/_build/doctrees/index.doctree index 7541f6e..0cbb8df 100644 Binary files a/docs/_build/doctrees/index.doctree and b/docs/_build/doctrees/index.doctree differ diff --git a/docs/_build/html/_modules/travispy/entities/_entity.html b/docs/_build/html/_modules/travispy/entities/_entity.html index 1fb1d4b..1b8edb1 100644 --- a/docs/_build/html/_modules/travispy/entities/_entity.html +++ b/docs/_build/html/_modules/travispy/entities/_entity.html @@ -68,7 +68,7 @@

Source code for travispy.entities._entity

 #===================================================================================================
 # Entity
 #===================================================================================================
-
[docs]class Entity(object): +
[docs]class Entity(object): ''' Base class for all |travisci| entities. @@ -90,7 +90,7 @@

Source code for travispy.entities._entity

 
 
     @classmethod
-
[docs] def one(cls): +
[docs] def one(cls): ''' :rtype: str :returns: @@ -101,7 +101,7 @@

Source code for travispy.entities._entity

 
 
@classmethod -
[docs] def many(cls): +
[docs] def many(cls): ''' :rtype: str :returns: diff --git a/docs/_build/html/_modules/travispy/entities/_restartable.html b/docs/_build/html/_modules/travispy/entities/_restartable.html index 64b2213..ad4bc6b 100644 --- a/docs/_build/html/_modules/travispy/entities/_restartable.html +++ b/docs/_build/html/_modules/travispy/entities/_restartable.html @@ -72,12 +72,12 @@

Source code for travispy.entities._restartable

#=================================================================================================== # Restartable #=================================================================================================== -

[docs]class Restartable(Entity): +
[docs]class Restartable(Entity): ''' Base class for restartable entities such as :class:`.Build` and :class:`.Job`. ''' -
[docs] def cancel(self): +
[docs] def cancel(self): ''' Method responsible for canceling current action of this object. @@ -89,7 +89,7 @@

Source code for travispy.entities._restartable

return response.status_code == 204

-
[docs] def restart(self): +
[docs] def restart(self): ''' Method responsible for restarting the last action executed by this action. diff --git a/docs/_build/html/_modules/travispy/travispy.html b/docs/_build/html/_modules/travispy/travispy.html index cbbddf0..489af29 100644 --- a/docs/_build/html/_modules/travispy/travispy.html +++ b/docs/_build/html/_modules/travispy/travispy.html @@ -90,7 +90,7 @@

Source code for travispy.travispy

 #===================================================================================================
 # TravisPy
 #===================================================================================================
-
[docs]class TravisPy: +
[docs]class TravisPy: ''' Instances of this class are responsible for comunicating with |travisci|, sending requests and handling responses properly. You can create as much instances as you want since each one will @@ -126,7 +126,7 @@

Source code for travispy.travispy

 
 
     @classmethod
-
[docs] def github_auth(cls, token, uri=PUBLIC): +
[docs] def github_auth(cls, token, uri=PUBLIC): ''' :param str token: GitHub access token. @@ -143,7 +143,7 @@

Source code for travispy.travispy

 
 
     # Accounts -------------------------------------------------------------------------------------
-
[docs] def accounts(self, all=False): +
[docs] def accounts(self, all=False): ''' :param bool all: Whether or not to include accounts the user does not have admin access to. @@ -159,7 +159,7 @@

Source code for travispy.travispy

         return self._session.find_many(Account, all=all)
 
 
-
[docs] def account(self, account_id): +
[docs] def account(self, account_id): ''' :param int account_id: ID of the account to obtain information. @@ -175,7 +175,7 @@

Source code for travispy.travispy

 
 
     # Broadcasts -----------------------------------------------------------------------------------
-
[docs] def broadcasts(self): +
[docs] def broadcasts(self): ''' :rtype: list(:class:`.Broadcast`) @@ -186,7 +186,7 @@

Source code for travispy.travispy

 
 
     # Builds ---------------------------------------------------------------------------------------
-
[docs] def builds(self, **kwargs): +
[docs] def builds(self, **kwargs): ''' :keyword list(int) ids: List of build ids to fetch. @@ -222,7 +222,7 @@

Source code for travispy.travispy

         return self._session.find_many(Build, **kwargs)
 
 
-
[docs] def build(self, build_id): +
[docs] def build(self, build_id): ''' :param int build_id: ID of the build to obtain information. @@ -233,7 +233,7 @@

Source code for travispy.travispy

 
 
     # Hooks ----------------------------------------------------------------------------------------
-
[docs] def hooks(self): +
[docs] def hooks(self): ''' :rtype: list(:class:`.Hook`) :returns: @@ -246,7 +246,7 @@

Source code for travispy.travispy

 
 
     # Jobs -----------------------------------------------------------------------------------------
-
[docs] def jobs(self, **kwargs): +
[docs] def jobs(self, **kwargs): ''' :keyword list(int) ids: List of jobs IDs. @@ -277,7 +277,7 @@

Source code for travispy.travispy

         return self._session.find_many(Job, **kwargs)
 
 
-
[docs] def job(self, job_id): +
[docs] def job(self, job_id): ''' :param int job_id: ID of the job to obtain information. @@ -288,7 +288,7 @@

Source code for travispy.travispy

 
 
     # Log ------------------------------------------------------------------------------------------
-
[docs] def log(self, log_id): +
[docs] def log(self, log_id): ''' :param int log_id: ID of the log to obtain information. @@ -299,7 +299,7 @@

Source code for travispy.travispy

 
 
     # Repositories ---------------------------------------------------------------------------------
-
[docs] def repos(self, **kwargs): +
[docs] def repos(self, **kwargs): ''' :keyword list(int) ids: List of repository ids to fetch, cannot be combined with other parameters. @@ -327,7 +327,7 @@

Source code for travispy.travispy

         return self._session.find_many(Repo, **kwargs)
 
 
-
[docs] def repo(self, id_or_slug): +
[docs] def repo(self, id_or_slug): ''' :type id_or_slug: int | str :param id_or_slug: @@ -339,7 +339,7 @@

Source code for travispy.travispy

 
 
     # Users ----------------------------------------------------------------------------------------
-
[docs] def user(self): +
[docs] def user(self): ''' :rtype: :class:`.User` :returns: diff --git a/docs/_build/html/_sources/api.txt b/docs/_build/html/_sources/api.txt new file mode 100644 index 0000000..23cd9b8 --- /dev/null +++ b/docs/_build/html/_sources/api.txt @@ -0,0 +1,19 @@ +.. |travispy| replace:: **TravisPy** +.. |travisci| replace:: *Travis CI* +.. |github| replace:: *GitHub* + +.. _official API: http://docs.travis-ci.com/api/ +.. _Ruby: https://github.com/travis-ci/travis.rb#ruby-library +.. _requirement: http://docs.travis-ci.com/api/#external-apis +.. _access token: https://github.com/settings/applications +.. _entities: http://docs.travis-ci.com/api/#entities +.. _open issues: https://github.com/menegazzo/travispy/issues?state=open + +=== +API +=== + +This document brings the public API of |travispy|. + +.. automodule:: travispy.travispy + :no-show-inheritance: diff --git a/docs/_build/html/_sources/entities.txt b/docs/_build/html/_sources/entities.txt new file mode 100644 index 0000000..5e9d17e --- /dev/null +++ b/docs/_build/html/_sources/entities.txt @@ -0,0 +1,43 @@ +.. |travispy| replace:: **TravisPy** +.. |travisci| replace:: *Travis CI* +.. |github| replace:: *GitHub* + +.. _official API: http://docs.travis-ci.com/api/ +.. _Ruby: https://github.com/travis-ci/travis.rb#ruby-library +.. _requirement: http://docs.travis-ci.com/api/#external-apis +.. _access token: https://github.com/settings/applications +.. _entities: http://docs.travis-ci.com/api/#entities +.. _open issues: https://github.com/menegazzo/travispy/issues?state=open + +======== +Entities +======== + +This document brings information about all entities that are used by |travispy| API. + +.. autoclass:: Session + :no-show-inheritance: + +.. module:: travispy.entities._entity +.. autoclass:: Entity + :no-show-inheritance: + +.. module:: travispy.entities._restartable +.. autoclass:: Restartable + +.. module:: travispy.entities +.. autoclass:: Account + +.. autoclass:: Broadcast + +.. autoclass:: Build + +.. autoclass:: Hook + +.. autoclass:: Job + +.. autoclass:: Log + +.. autoclass:: Repo + +.. autoclass:: User diff --git a/docs/_build/html/_sources/getting_started.txt b/docs/_build/html/_sources/getting_started.txt new file mode 100644 index 0000000..7d1d376 --- /dev/null +++ b/docs/_build/html/_sources/getting_started.txt @@ -0,0 +1,68 @@ +.. |travispy| replace:: **TravisPy** +.. |travisci| replace:: *Travis CI* +.. |github| replace:: *GitHub* + +.. _official API: http://docs.travis-ci.com/api/ +.. _Ruby: https://github.com/travis-ci/travis.rb#ruby-library +.. _requirement: http://docs.travis-ci.com/api/#external-apis +.. _access token: https://github.com/settings/applications +.. _entities: http://docs.travis-ci.com/api/#entities +.. _open issues: https://github.com/menegazzo/travispy/issues?state=open + +=============== +Getting started +=============== + +|travispy| works just as |travisci|: 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() + >>> user = t.user() + >>> user + + +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[0] + + >>> repos[0].slug + 'travispy/on_py34' + +Or simply request for repository you want:: + + >>> repo = r.repo('travispy/on_py34') + + +And finally, getting build information:: + + >>> build = t.build(repo.last_build_id) + >>> build + + >>> build.restart() + True + >>> build.cancel() + True + >>> build.cancel() # As build was already cancelled it will return False. + 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. diff --git a/docs/_build/html/_sources/index.txt b/docs/_build/html/_sources/index.txt index c3f6164..1b54222 100644 --- a/docs/_build/html/_sources/index.txt +++ b/docs/_build/html/_sources/index.txt @@ -1,8 +1,3 @@ -.. TravisPy documentation master file, created by - sphinx-quickstart on Wed Jul 2 10:35:41 2014. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - .. |travispy| replace:: **TravisPy** .. |travisci| replace:: *Travis CI* .. |github| replace:: *GitHub* @@ -14,8 +9,9 @@ .. _entities: http://docs.travis-ci.com/api/#entities .. _open issues: https://github.com/menegazzo/travispy/issues?state=open -Introduction -============ +======== +TravisPy +======== .. automodule:: travispy @@ -26,102 +22,15 @@ To install |travispy| all it takes is one command line:: pip install travispy -Quick start -=========== - -|travispy| works just as |travisci|: 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() - >>> user = t.user() - >>> user - - -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[0] - - >>> repos[0].slug - 'travispy/on_py34' - -Or simply request for repository you want:: - - >>> repo = r.repo('travispy/on_py34') - - -And finally, getting build information:: - - >>> build = t.build(repo.last_build_id) - >>> build - - >>> build.restart() - True - >>> build.cancel() - True - >>> build.cancel() # As build was already cancelled it will return False. - 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. - -Constants -========= - -.. automodule:: travispy.travispy - :no-members: - -Classes -======= - -.. module:: travispy.travispy -.. autoclass:: TravisPy - :no-show-inheritance: - -.. autoclass:: Session - :no-show-inheritance: - -.. module:: travispy.entities._entity -.. autoclass:: Entity - :no-show-inheritance: - -.. module:: travispy.entities._restartable -.. autoclass:: Restartable - -.. module:: travispy.entities -.. autoclass:: Account - -.. autoclass:: Broadcast - -.. autoclass:: Build - -.. autoclass:: Hook - -.. autoclass:: Job - -.. autoclass:: Log - -.. autoclass:: Repo +Documentation +============= -.. autoclass:: User +.. toctree:: + :maxdepth: 2 + + getting_started + api + entities Support ======= diff --git a/docs/_build/html/api.html b/docs/_build/html/api.html new file mode 100644 index 0000000..90cbcdb --- /dev/null +++ b/docs/_build/html/api.html @@ -0,0 +1,418 @@ + + + + + + + + API — TravisPy 0.1.1 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

Getting started

+

Next topic

+

Entities

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

API

+

This document brings the public API of TravisPy.

+
+
+travispy.travispy.PUBLIC = URI for Travis CI free service.
+
+ +
+
+travispy.travispy.PRIVATE = URI for Travis CI paid service for GitHub private repositories.
+
+ +
+
+travispy.travispy.ENTERPRISE = URI template for Travis CI service running under a personal domain. Usage will be +something like ENTERPRISE % {'domain': 'http://travis.example.com'}.
+
+ +
+
+class travispy.travispy.TravisPy(token=None, uri='http://api.travis-ci.org')[source]
+

Instances of this class are responsible for comunicating with Travis CI, sending requests and +handling responses properly. You can create as much instances as you want since each one will +create a separated session.

+ +++ + + + +
Parameters:
    +
  • token (str | None) –

    Travis CI token linked to your GitHub account.

    +

    Even if you have a public repository, some information are related to your user account +and not the repository itself so if token is not provided an error will be returned.

    +

    Required for private and enterprise repositories to access any information.

    +
  • +
  • uri (PUBLIC | PRIVATE | ENTERPRISE | str) – URI where Travis CI service is running.
  • +
+
+
+

Note

+

Do not confuse token with the one found on your profile page.

+
+
+
+account(account_id)[source]
+
+++ + + + + + +
Parameters:account_id (int) – ID of the account to obtain information.
Return type:Account
+
+

Note

+

This request always needs to be authenticated.

+
+
+ +
+
+accounts(all=False)[source]
+
+++ + + + + + + + +
Parameters:all (bool) – Whether or not to include accounts the user does not have admin access to.
Return type:list(Account)
Returns:Information of all accounts that the user might have access.This is usually the account +corresponding to the user directly and one account per GitHub organization.
+
+

Note

+

This request always needs to be authenticated.

+
+
+ +
+
+broadcasts()[source]
+
+++ + + + +
Return type:list(Broadcast)
+
+

Note

+

This request always needs to be authenticated.

+
+
+ +
+
+build(build_id)[source]
+
+++ + + + + + +
Parameters:build_id (int) – ID of the build to obtain information.
Return type:Build
+
+ +
+
+builds(**kwargs)[source]
+
+++ + + + + + +
Parameters:
    +
  • ids (list(int)) – List of build ids to fetch.
  • +
  • repository_id (int) – Repository id the build belongs to.
  • +
  • slug (str) – Repository slug the build belongs to.
  • +
  • number (str) – Filter by build number, requires slug or repository_id.
  • +
  • after_number (str) – List build after a given build number (use for pagination), requires slug or +repository_id.
  • +
  • event_type (str) – Limit build to given event type (push or pull_request).
  • +
+
Return type:

list(Build)

+
+
+

Note

+

You have to supply either ids, repository_id or slug.

+
+
+ +
+
+classmethod github_auth(token, uri='http://api.travis-ci.org')[source]
+
+++ + + + +
Parameters:
    +
  • token (str) – GitHub access token.
  • +
  • uri – See __init__()
  • +
+
+
+ +
+
+hooks()[source]
+
+++ + + + + + +
Return type:list(Hook)
Returns:Returns list of existing hooks that user have access.
+
+

Note

+

This request always needs to be authenticated.

+
+
+ +
+
+job(job_id)[source]
+
+++ + + + + + +
Parameters:job_id (int) – ID of the job to obtain information.
Return type:Job
+
+ +
+
+jobs(**kwargs)[source]
+
+++ + + + + + +
Parameters:
    +
  • ids (list(int)) – List of jobs IDs.
  • +
  • state (str) – Job state to filter by. Possible values are passed, canceled, failed and +errored.
  • +
  • queue (str) – Job queue to filter by.
  • +
+
Return type:

list(Job)

+
+
+

Note

+

You need to provide exactly one of the above parameters. If you provide state or +queue, a maximum of 250 jobs will be returned.

+
+
+ +
+
+log(log_id)[source]
+
+++ + + + + + +
Parameters:log_id (int) – ID of the log to obtain information.
Return type:Log
+
+ +
+
+repo(id_or_slug)[source]
+
+++ + + + + + +
Parameters:id_or_slug (int | str) – ID of slug of repository to obtain information.
Return type:Repo
+
+ +
+
+repos(**kwargs)[source]
+
+++ + + + + + +
Parameters:
    +
  • ids (list(int)) – List of repository ids to fetch, cannot be combined with other parameters.
  • +
  • member (str) – Filter by user that has access to it (GitHub login).
  • +
  • owner_name (str) – Filter by owner name (first segment of slug).
  • +
  • slug (str) – Filter by slug.
  • +
  • search (str) – Filter by search term.
  • +
  • active (bool) – If True, will only return repositories that are enabled. Default is False.
  • +
+
Return type:

list(Repo)

+
+
+

Note

+

If no parameters are given, a list of repositories with recent activity is returned.

+
+
+ +
+
+user()[source]
+
+++ + + + + + +
Return type:User
Returns:Information about user currently logged in.
+
+

Note

+

This request always needs to be authenticated.

+
+
+ +
+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/_build/html/entities.html b/docs/_build/html/entities.html new file mode 100644 index 0000000..befec7b --- /dev/null +++ b/docs/_build/html/entities.html @@ -0,0 +1,384 @@ + + + + + + + + Entities — TravisPy 0.1.1 documentation + + + + + + + + + + + + + +
+
+

Previous topic

+

API

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

Entities

+

This document brings information about all entities that are used by TravisPy API.

+
+
+class travispy.entities._entity.Entity(session)[source]
+

Base class for all Travis CI entities.

+ +++ + + + + + +
Parameters:session (Session) – Internet session in which entity information will be requested.
Variables:id (int) – The entity ID.
+
+
+classmethod many()[source]
+
+++ + + + + + +
Return type:str
Returns:String representation for multiple entities. +Example: for Account will be accounts.
+
+ +
+
+classmethod one()[source]
+
+++ + + + + + +
Return type:str
Returns:String representation for a single entity. +Example: for Account will be account.
+
+ +
+ +
+
+class travispy.entities._restartable.Restartable(session)[source]
+

Bases: travispy.entities._entity.Entity

+

Base class for restartable entities such as Build and Job.

+
+
+cancel()[source]
+

Method responsible for canceling current action of this object.

+ +++ + + + + + +
Return type:bool
Returns:True if cancel request was send successfuly to Travis CI.
+
+ +
+
+restart()[source]
+

Method responsible for restarting the last action executed by this action.

+ +++ + + + + + +
Return type:bool
Returns:True if restart request was send successfuly to Travis CI.
+
+ +
+ +
+
+class travispy.entities.Account(session)
+

Bases: travispy.entities._entity.Entity

+

A user might have access to multiple accounts. This is usually the account corresponding to the +user directly and one account per GitHub organization.

+ +++ + + + +
Variables:
    +
  • name (str) – User or organization id.
  • +
  • login (str) – Account name on GitHub.
  • +
  • type (str) – Account login on GitHub.
  • +
  • repos_count (int) – Number of repositories.
  • +
  • subscribed (bool) – Whether or not the account has a valid subscription. +Only available on Travis Pro.
  • +
+
+
+ +
+
+class travispy.entities.Broadcast(session)
+

Bases: travispy.entities._entity.Entity

+ +++ + + + +
Variables:message (str) – Broadcast message.
+
+ +
+
+class travispy.entities.Build(session)
+

Bases: travispy.entities._restartable.Restartable

+ +++ + + + +
Variables:
    +
  • repository_id (int) – Repository ID.
  • +
  • commit_id (str) – Commit ID.
  • +
  • number (str) – Build number.
  • +
  • pull_request (bool) – Whether or not the build comes from a pull request.
  • +
  • pull_request_title (str) – PR title if pull_request is True.
  • +
  • pull_request_number (str) – PR number if pull_request is True.
  • +
  • config (dict) – Build config (secure values and ssh key removed). It comes from .travis.yml file.
  • +
  • state (str) – Build state.
  • +
  • started_at (str) – Time the build was started.
  • +
  • finished_at (str) – Time the build finished.
  • +
  • duration (str) – Build duration. It might not correspond to finished_at - started_at if the +build was restarted at a later point.
  • +
  • job_ids (list(int)) – List of job IDs in the build matrix.
  • +
+
+
+ +
+
+class travispy.entities.Hook(session)
+

Bases: travispy.entities._entity.Entity

+ +++ + + + +
Variables:
    +
  • name (str) – Hook name.
  • +
  • description (str) – Hook description.
  • +
  • owner_name (str) – Owner name.
  • +
  • active (str) – Whether or not the hook is active.
  • +
  • private (str) – Whether or not the hook is private.
  • +
  • admin (bool) – Whether or not current user has administrator privileges.
  • +
+
+
+ +
+
+class travispy.entities.Job(session)
+

Bases: travispy.entities._restartable.Restartable

+ +++ + + + +
Variables:
    +
  • build_id (int) – Build ID.
  • +
  • repository_id (int) – Repository ID.
  • +
  • commit_id (int) – Commit ID.
  • +
  • log_id (int) – Log ID.
  • +
  • number (str) – Job number.
  • +
  • config (dict) – Job config (secure values and ssh key removed). It comes from .travis.yml file.
  • +
  • state (str) – Job state.
  • +
  • started_at (str) – Time the job was started.
  • +
  • finished_at (str) – Time the job finished.
  • +
  • duration (str) – Job duration. It might not correspond to finished_at - started_at if the +job was restarted at a later point.
  • +
  • queue (str) – Job queue.
  • +
  • allow_failure (bool) – Whether or not the job state influences build state.
  • +
  • annotation_ids (list(int)) – List of annotation IDs.
  • +
+
+
+ +
+
+class travispy.entities.Log(session)
+

Bases: travispy.entities._entity.Entity

+ +++ + + + +
Variables:
    +
  • job_id (int) – Jod ID.
  • +
  • body (str) – Log body.
  • +
  • type (str) –
  • +
+
+
+ +
+
+class travispy.entities.Repo(session)
+

Bases: travispy.entities._entity.Entity

+ +++ + + + +
Variables:
    +
  • slug (str) – Repository slug.
  • +
  • description (str) – Description on GitHub.
  • +
  • last_build_id (int) – Build ID of the last executed build.
  • +
  • last_build_number (str) – Build number of the last executed build.
  • +
  • last_build_state (str) – Build state of the last executed build.
  • +
  • last_build_duration (str) – Build duration of the last executed build.
  • +
  • last_build_started_at (str) – Build started at of the last executed build.
  • +
  • last_build_finished_at (str) – Build finished at of the last executed build.
  • +
  • github_language (str) – Language on GitHub.
  • +
  • active (bool) – Whether or not the repository is active on Travis CI.
  • +
+
+
+ +
+
+class travispy.entities.User(session)
+

Bases: travispy.entities._entity.Entity

+ +++ + + + +
Variables:
    +
  • login (str) – User login on GitHub.
  • +
  • name (str) – User name on GitHub.
  • +
  • email (str) – Primary email address on GitHub.
  • +
  • gravatar_id (str) – Avatar ID.
  • +
  • is_syncing (bool) – Whether or not user account is currently being synced.
  • +
  • synced_at (str) – Last synced at.
  • +
  • correct_scopes (bool) – Whether or not GitHub token has the correct scopes.
  • +
  • channels (str) – Pusher channels for this user.
  • +
  • created_at (str) – When account was created.
  • +
  • locale (str) – User main locale.
  • +
+
+
+ +
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/_build/html/genindex.html b/docs/_build/html/genindex.html index 7b796aa..715f2e8 100644 --- a/docs/_build/html/genindex.html +++ b/docs/_build/html/genindex.html @@ -73,7 +73,6 @@

Index

| B | C | E - | F | G | H | J @@ -82,7 +81,6 @@

Index

| O | P | R - | S | T | U @@ -91,17 +89,17 @@

A

@@ -111,25 +109,25 @@

B

-
Account (class in travispy.entities) +
Account (class in travispy.entities)
-
account() (travispy.travispy.TravisPy method) +
account() (travispy.travispy.TravisPy method)
-
accounts() (travispy.travispy.TravisPy method) +
accounts() (travispy.travispy.TravisPy method)
@@ -139,7 +137,7 @@

C

-
Broadcast (class in travispy.entities) +
Broadcast (class in travispy.entities)
-
broadcasts() (travispy.travispy.TravisPy method) +
broadcasts() (travispy.travispy.TravisPy method)
-
Build (class in travispy.entities) +
Build (class in travispy.entities)
-
build() (travispy.travispy.TravisPy method) +
build() (travispy.travispy.TravisPy method)
-
builds() (travispy.travispy.TravisPy method) +
builds() (travispy.travispy.TravisPy method)
@@ -149,29 +147,13 @@

E

-
cancel() (travispy.entities._restartable.Restartable method) +
cancel() (travispy.entities._restartable.Restartable method)
-
-
ENTERPRISE (in module travispy.travispy) +
ENTERPRISE (in module travispy.travispy)
-
Entity (class in travispy.entities._entity) -
- -
- -

F

- - - @@ -181,7 +163,7 @@

G

- -
find_many() (travispy.travispy.Session method) -
- -
- -
find_one() (travispy.travispy.Session method) +
Entity (class in travispy.entities._entity)
@@ -191,13 +173,13 @@

H

-
github_auth() (travispy.travispy.TravisPy class method) +
github_auth() (travispy.travispy.TravisPy class method)
@@ -207,17 +189,17 @@

J

-
Hook (class in travispy.entities) +
Hook (class in travispy.entities)
-
hooks() (travispy.travispy.TravisPy method) +
hooks() (travispy.travispy.TravisPy method)
@@ -227,13 +209,13 @@

L

-
Job (class in travispy.entities) +
Job (class in travispy.entities)
-
job() (travispy.travispy.TravisPy method) +
job() (travispy.travispy.TravisPy method)
-
jobs() (travispy.travispy.TravisPy method) +
jobs() (travispy.travispy.TravisPy method)
@@ -243,7 +225,7 @@

M

-
Log (class in travispy.entities) +
Log (class in travispy.entities)
-
log() (travispy.travispy.TravisPy method) +
log() (travispy.travispy.TravisPy method)
@@ -253,7 +235,7 @@

O

-
many() (travispy.entities._entity.Entity class method) +
many() (travispy.entities._entity.Entity class method)
@@ -263,13 +245,13 @@

P

-
one() (travispy.entities._entity.Entity class method) +
one() (travispy.entities._entity.Entity class method)
@@ -279,35 +261,25 @@

R

-
PRIVATE (in module travispy.travispy) +
PRIVATE (in module travispy.travispy)
-
PUBLIC (in module travispy.travispy) +
PUBLIC (in module travispy.travispy)
-
-
Repo (class in travispy.entities) +
Repo (class in travispy.entities)
-
repo() (travispy.travispy.TravisPy method) +
repo() (travispy.travispy.TravisPy method)
-
repos() (travispy.travispy.TravisPy method) +
repos() (travispy.travispy.TravisPy method)
-
restart() (travispy.entities._restartable.Restartable method) -
- - -
Restartable (class in travispy.entities._restartable) +
restart() (travispy.entities._restartable.Restartable method)
-
- -

S

- - @@ -317,7 +289,7 @@

T

-
Session (class in travispy.travispy) +
Restartable (class in travispy.entities._restartable)
@@ -349,13 +321,13 @@

U

-
TravisPy (class in travispy.travispy) +
TravisPy (class in travispy.travispy)
@@ -325,21 +297,21 @@

T

-
travispy.entities (module) +
travispy.entities (module)
-
travispy.entities._entity (module) +
travispy.entities._entity (module)
-
travispy.entities._restartable (module) +
travispy.entities._restartable (module)
-
travispy.travispy (module), [1] +
travispy.travispy (module)
diff --git a/docs/_build/html/getting_started.html b/docs/_build/html/getting_started.html new file mode 100644 index 0000000..5ba770c --- /dev/null +++ b/docs/_build/html/getting_started.html @@ -0,0 +1,169 @@ + + + + + + + + Getting started — TravisPy 0.1.1 documentation + + + + + + + + + + + + + + +
+
+

Previous topic

+

TravisPy

+

Next topic

+

API

+

This Page

+ + + +
+
+ +
+
+
+
+ +
+

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
+'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[0]
+<travispy.entities.repo.Repo object at 0x02C26C49>
+>>> repos[0].slug
+'travispy/on_py34'
+
+
+

Or simply request for repository you want:

+
>>> repo = r.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
+
+
+

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.

+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/_build/html/index.html b/docs/_build/html/index.html index c6a86a4..24826af 100644 --- a/docs/_build/html/index.html +++ b/docs/_build/html/index.html @@ -6,7 +6,7 @@ - Introduction — TravisPy 0.1.1 documentation + TravisPy — TravisPy 0.1.1 documentation @@ -23,7 +23,8 @@ - + + @@ -42,16 +46,19 @@

Navigation

Table Of Contents

+

Next topic

+

Getting started

This Page

  • Quick search
    -

    Introduction

    +

    TravisPy

    TravisPy is a Python API for Travis CI. It follows the official API and is implemented as similar as possible to Ruby implementation.

    Experimental methods will not be supported until they become official.

    @@ -88,711 +95,29 @@

    Quick search

    License Build status Coveralls -
    -

    Install

    +

    Install

    To install TravisPy all it takes is one command line:

    pip install travispy
     
    -
    -

    Quick start

    -

    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
    -'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[0]
    -<travispy.entities.repo.Repo object at 0x02C26C49>
    ->>> repos[0].slug
    -'travispy/on_py34'
    -
    -
    -

    Or simply request for repository you want:

    -
    >>> repo = r.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
    -
    -
    -

    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.

    -
    -
    -

    Constants

    -
    -
    -travispy.travispy.PUBLIC = URI for Travis CI free service.
    -
    - -
    -
    -travispy.travispy.PRIVATE = URI for Travis CI paid service for GitHub private repositories.
    -
    - -
    -
    -travispy.travispy.ENTERPRISE = URI template for Travis CI service running under a personal domain. Usage will be -something like ENTERPRISE % {'domain': 'http://travis.example.com'}.
    -
    - -
    -
    -

    Classes

    -
    -
    -class travispy.travispy.TravisPy(token=None, uri='http://api.travis-ci.org')[source]
    -

    Instances of this class are responsible for comunicating with Travis CI, sending requests and -handling responses properly. You can create as much instances as you want since each one will -create a separated session.

    -
-
User (class in travispy.entities) +
User (class in travispy.entities)
-
user() (travispy.travispy.TravisPy method) +
user() (travispy.travispy.TravisPy method)
--- - - - -
Parameters:
    -
  • token (str | None) –

    Travis CI token linked to your GitHub account.

    -

    Even if you have a public repository, some information are related to your user account -and not the repository itself so if token is not provided an error will be returned.

    -

    Required for private and enterprise repositories to access any information.

    -
  • -
  • uri (PUBLIC | PRIVATE | ENTERPRISE | str) – URI where Travis CI service is running.
  • -
-
-
-

Note

-

Do not confuse token with the one found on your profile page.

-
-
-
-account(account_id)[source]
-
--- - - - - - -
Parameters:account_id (int) – ID of the account to obtain information.
Return type:Account
-
-

Note

-

This request always needs to be authenticated.

-
-
- -
-
-accounts(all=False)[source]
-
--- - - - - - - - -
Parameters:all (bool) – Whether or not to include accounts the user does not have admin access to.
Return type:list(Account)
Returns:Information of all accounts that the user might have access.This is usually the account -corresponding to the user directly and one account per GitHub organization.
-
-

Note

-

This request always needs to be authenticated.

-
-
- -
-
-broadcasts()[source]
-
--- - - - -
Return type:list(Broadcast)
-
-

Note

-

This request always needs to be authenticated.

-
-
- -
-
-build(build_id)[source]
-
--- - - - - - -
Parameters:build_id (int) – ID of the build to obtain information.
Return type:Build
-
- -
-
-builds(**kwargs)[source]
-
--- - - - - - -
Parameters:
    -
  • ids (list(int)) – List of build ids to fetch.
  • -
  • repository_id (int) – Repository id the build belongs to.
  • -
  • slug (str) – Repository slug the build belongs to.
  • -
  • number (str) – Filter by build number, requires slug or repository_id.
  • -
  • after_number (str) – List build after a given build number (use for pagination), requires slug or -repository_id.
  • -
  • event_type (str) – Limit build to given event type (push or pull_request).
  • +
    +

    Documentation

    +
Return type:

list(Build)

-
-
-

Note

-

You have to supply either ids, repository_id or slug.

-
- -
-
-classmethod github_auth(token, uri='http://api.travis-ci.org')[source]
-
--- - - - -
Parameters:
    -
  • token (str) – GitHub access token.
  • -
  • uri – See __init__()
  • -
-
-
- -
-
-hooks()[source]
-
--- - - - - - -
Return type:list(Hook)
Returns:Returns list of existing hooks that user have access.
-
-

Note

-

This request always needs to be authenticated.

-
-
- -
-
-job(job_id)[source]
-
--- - - - - - -
Parameters:job_id (int) – ID of the job to obtain information.
Return type:Job
-
- -
-
-jobs(**kwargs)[source]
-
--- - - - - - -
Parameters:
    -
  • ids (list(int)) – List of jobs IDs.
  • -
  • state (str) – Job state to filter by. Possible values are passed, canceled, failed and -errored.
  • -
  • queue (str) – Job queue to filter by.
  • -
-
Return type:

list(Job)

-
-
-

Note

-

You need to provide exactly one of the above parameters. If you provide state or -queue, a maximum of 250 jobs will be returned.

-
-
- -
-
-log(log_id)[source]
-
--- - - - - - -
Parameters:log_id (int) – ID of the log to obtain information.
Return type:Log
-
- -
-
-repo(id_or_slug)[source]
-
--- - - - - - -
Parameters:id_or_slug (int | str) – ID of slug of repository to obtain information.
Return type:Repo
-
- -
-
-repos(**kwargs)[source]
-
--- - - - - - -
Parameters:
    -
  • ids (list(int)) – List of repository ids to fetch, cannot be combined with other parameters.
  • -
  • member (str) – Filter by user that has access to it (GitHub login).
  • -
  • owner_name (str) – Filter by owner name (first segment of slug).
  • -
  • slug (str) – Filter by slug.
  • -
  • search (str) – Filter by search term.
  • -
  • active (bool) – If True, will only return repositories that are enabled. Default is False.
  • -
-
Return type:

list(Repo)

-
-
-

Note

-

If no parameters are given, a list of repositories with recent activity is returned.

-
-
- -
-
-user()[source]
-
--- - - - - - -
Return type:User
Returns:Information about user currently logged in.
-
-

Note

-

This request always needs to be authenticated.

-
-
- - - -
-
-class travispy.travispy.Session(uri)
-

Internet session created to perform requests to Travis CI.

- --- - - - -
Parameters:uri (str) – URI where session will start.
-
-
-find_many(entity_class, **kwargs)
-

Method responsible for returning as many as possible matches for given entity_class.

- --- - - - - - -
Parameters:entity_class (Entity) – Class of entity that information will be retrieved from Travis CI.
Return type:list(entity_class)
-
- -
-
-find_one(entity_class, entity_id, **kwargs)
-

Method responsible for returning exactly one instance of the given entity_class.

- --- - - - - - -
Parameters:
    -
  • entity_class (Entity) – Class of entity that information will be retrieved from Travis CI.
  • -
  • entity_id (int) – The ID of the entity.
  • -
-
Return type:

entity_class instance

-
-
- -
- -
-
-class travispy.entities._entity.Entity(session)[source]
-

Base class for all Travis CI entities.

- --- - - - - - -
Parameters:session (Session) – Internet session in which entity information will be requested.
Variables:id (int) – The entity ID.
-
-
-classmethod many()[source]
-
--- - - - - - -
Return type:str
Returns:String representation for multiple entities. -Example: for Account will be accounts.
-
- -
-
-classmethod one()[source]
-
--- - - - - - -
Return type:str
Returns:String representation for a single entity. -Example: for Account will be account.
-
- -
- -
-
-class travispy.entities._restartable.Restartable(session)[source]
-

Bases: travispy.entities._entity.Entity

-

Base class for restartable entities such as Build and Job.

-
-
-cancel()[source]
-

Method responsible for canceling current action of this object.

- --- - - - - - -
Return type:bool
Returns:True if cancel request was send successfuly to Travis CI.
-
- -
-
-restart()[source]
-

Method responsible for restarting the last action executed by this action.

- --- - - - - - -
Return type:bool
Returns:True if restart request was send successfuly to Travis CI.
-
- -
- -
-
-class travispy.entities.Account(session)
-

Bases: travispy.entities._entity.Entity

-

A user might have access to multiple accounts. This is usually the account corresponding to the -user directly and one account per GitHub organization.

- --- - - - -
Variables:
    -
  • name (str) – User or organization id.
  • -
  • login (str) – Account name on GitHub.
  • -
  • type (str) – Account login on GitHub.
  • -
  • repos_count (int) – Number of repositories.
  • -
  • subscribed (bool) – Whether or not the account has a valid subscription. -Only available on Travis Pro.
  • -
-
-
- -
-
-class travispy.entities.Broadcast(session)
-

Bases: travispy.entities._entity.Entity

- --- - - - -
Variables:message (str) – Broadcast message.
-
- -
-
-class travispy.entities.Build(session)
-

Bases: travispy.entities._restartable.Restartable

- --- - - - -
Variables:
    -
  • repository_id (int) – Repository ID.
  • -
  • commit_id (str) – Commit ID.
  • -
  • number (str) – Build number.
  • -
  • pull_request (bool) – Whether or not the build comes from a pull request.
  • -
  • pull_request_title (str) – PR title if pull_request is True.
  • -
  • pull_request_number (str) – PR number if pull_request is True.
  • -
  • config (dict) – Build config (secure values and ssh key removed). It comes from .travis.yml file.
  • -
  • state (str) – Build state.
  • -
  • started_at (str) – Time the build was started.
  • -
  • finished_at (str) – Time the build finished.
  • -
  • duration (str) – Build duration. It might not correspond to finished_at - started_at if the -build was restarted at a later point.
  • -
  • job_ids (list(int)) – List of job IDs in the build matrix.
  • -
-
-
- -
-
-class travispy.entities.Hook(session)
-

Bases: travispy.entities._entity.Entity

- --- - - - -
Variables:
    -
  • name (str) – Hook name.
  • -
  • description (str) – Hook description.
  • -
  • owner_name (str) – Owner name.
  • -
  • active (str) – Whether or not the hook is active.
  • -
  • private (str) – Whether or not the hook is private.
  • -
  • admin (bool) – Whether or not current user has administrator privileges.
  • -
-
-
- -
-
-class travispy.entities.Job(session)
-

Bases: travispy.entities._restartable.Restartable

- --- - - - -
Variables:
    -
  • build_id (int) – Build ID.
  • -
  • repository_id (int) – Repository ID.
  • -
  • commit_id (int) – Commit ID.
  • -
  • log_id (int) – Log ID.
  • -
  • number (str) – Job number.
  • -
  • config (dict) – Job config (secure values and ssh key removed). It comes from .travis.yml file.
  • -
  • state (str) – Job state.
  • -
  • started_at (str) – Time the job was started.
  • -
  • finished_at (str) – Time the job finished.
  • -
  • duration (str) – Job duration. It might not correspond to finished_at - started_at if the -job was restarted at a later point.
  • -
  • queue (str) – Job queue.
  • -
  • allow_failure (bool) – Whether or not the job state influences build state.
  • -
  • annotation_ids (list(int)) – List of annotation IDs.
  • -
-
-
- -
-
-class travispy.entities.Log(session)
-

Bases: travispy.entities._entity.Entity

- --- - - - -
Variables:
    -
  • job_id (int) – Jod ID.
  • -
  • body (str) – Log body.
  • -
  • type (str) –
  • -
-
-
- -
-
-class travispy.entities.Repo(session)
-

Bases: travispy.entities._entity.Entity

- --- - - - -
Variables:
    -
  • slug (str) – Repository slug.
  • -
  • description (str) – Description on GitHub.
  • -
  • last_build_id (int) – Build ID of the last executed build.
  • -
  • last_build_number (str) – Build number of the last executed build.
  • -
  • last_build_state (str) – Build state of the last executed build.
  • -
  • last_build_duration (str) – Build duration of the last executed build.
  • -
  • last_build_started_at (str) – Build started at of the last executed build.
  • -
  • last_build_finished_at (str) – Build finished at of the last executed build.
  • -
  • github_language (str) – Language on GitHub.
  • -
  • active (bool) – Whether or not the repository is active on Travis CI.
  • -
-
-
- -
-
-class travispy.entities.User(session)
-

Bases: travispy.entities._entity.Entity

- --- - - - -
Variables:
    -
  • login (str) – User login on GitHub.
  • -
  • name (str) – User name on GitHub.
  • -
  • email (str) – Primary email address on GitHub.
  • -
  • gravatar_id (str) – Avatar ID.
  • -
  • is_syncing (bool) – Whether or not user account is currently being synced.
  • -
  • synced_at (str) – Last synced at.
  • -
  • correct_scopes (bool) – Whether or not GitHub token has the correct scopes.
  • -
  • channels (str) – Pusher channels for this user.
  • -
  • created_at (str) – When account was created.
  • -
  • locale (str) – User main locale.
  • -
-
-
-
-

Support

+

Support

Need help? Click here and open a new issue. You’ll get your answer ASAP.

-

Contribute

+

Contribute

TravisPy is under development, so if you want to join the team, you are welcome.

@@ -824,6 +150,9 @@

Navigation

  • modules |
  • +
  • + next |
  • TravisPy 0.1.1 documentation »
  • diff --git a/docs/_build/html/objects.inv b/docs/_build/html/objects.inv index 586dca8..a7ec631 100644 Binary files a/docs/_build/html/objects.inv and b/docs/_build/html/objects.inv differ diff --git a/docs/_build/html/py-modindex.html b/docs/_build/html/py-modindex.html index 557c841..a50a57f 100644 --- a/docs/_build/html/py-modindex.html +++ b/docs/_build/html/py-modindex.html @@ -84,22 +84,22 @@

    Python Module Index

        - travispy.entities + travispy.entities     - travispy.entities._entity + travispy.entities._entity     - travispy.entities._restartable + travispy.entities._restartable     - travispy.travispy + travispy.travispy diff --git a/docs/_build/html/searchindex.js b/docs/_build/html/searchindex.js index 273141a..c5b1f28 100644 --- a/docs/_build/html/searchindex.js +++ b/docs/_build/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({titles:["Introduction"],objects:{"":{travispy:[0,0,0,"-"]},"travispy.entities._entity":{Entity:[0,1,1,""]},"travispy.entities._entity.Entity":{one:[0,4,1,""],many:[0,4,1,""]},"travispy.travispy.Session":{find_many:[0,3,1,""],find_one:[0,3,1,""]},"travispy.entities":{Account:[0,1,1,""],Build:[0,1,1,""],"_restartable":[0,0,0,"-"],Job:[0,1,1,""],Log:[0,1,1,""],Hook:[0,1,1,""],Repo:[0,1,1,""],Broadcast:[0,1,1,""],"_entity":[0,0,0,"-"],User:[0,1,1,""]},"travispy.entities._restartable":{Restartable:[0,1,1,""]},travispy:{travispy:[0,0,0,"-"],entities:[0,0,0,"-"]},"travispy.entities._restartable.Restartable":{cancel:[0,3,1,""],restart:[0,3,1,""]},"travispy.travispy":{TravisPy:[0,1,1,""],Session:[0,1,1,""],ENTERPRISE:[0,2,1,""],PUBLIC:[0,2,1,""],PRIVATE:[0,2,1,""]},"travispy.travispy.TravisPy":{repos:[0,3,1,""],github_auth:[0,4,1,""],log:[0,3,1,""],accounts:[0,3,1,""],account:[0,3,1,""],broadcasts:[0,3,1,""],repo:[0,3,1,""],builds:[0,3,1,""],user:[0,3,1,""],job:[0,3,1,""],jobs:[0,3,1,""],hooks:[0,3,1,""],build:[0,3,1,""]}},objtypes:{"0":"py:module","1":"py:class","2":"py:data","3":"py:method","4":"py:classmethod"},terms:{make:0,usag:0,ssh:0,slug:0,log:0,annotation_id:0,str:0,"0x02c26c50":0,either:0,requir:0,confus:0,email:0,secur:0,config:0,full:0,local:0,"_entiti":0,"public":0,exist:0,implement:0,request:0,singl:0,"_restart":0,see:0,avail:0,your_github_token:0,given:0,test:0,page:0,link:0,under:0,usual:0,user:0,cannot:0,each:0,obtain:0,travi:0,kwarg:0,alwai:0,send:0,exactli:0,session:0,log_id:0,yml:0,belong:0,represent:0,combin:0,just:0,librari:0,scope:0,experiment:0,last_build_started_at:0,execut:0,pull:0,classmethod:0,until:0,github:0,onli:0,pass:0,repository_id:0,action:0,want:0,rubi:0,jod:0,ani:0,limit:0,is_sync:0,match:0,develop:0,feel:0,need:0,profil:0,statu:0,fetch:0,creat:0,where:0,created_at:0,take:0,annot:0,other:0,last:0,now:0,about:0,login:0,properli:0,separ:0,merg:0,"0x02c26c49":0,term:0,perform:0,found:0,inform:0,matrix:0,repos_count:0,python:0,pro:0,someth:0,number:0,includ:0,gravatar_id:0,write:0,asap:0,repo_deploy:0,activ:0,much:0,last_build_st:0,last_build_finished_at:0,queue:0,might:0,sinc:0,read:0,sync:0,must:0,repo_hook:0,correspond:0,becom:0,paramet:0,type:0,com:0,job:0,privat:0,descript:0,issu:0,doe:0,click:0,event:0,handl:0,name:0,last_build_numb:0,whether:0,similar:0,person:0,job_id:0,time:0,follow:0,account:0,after_numb:0,cancel:0,"return":0,synced_at:0,broadcast:0,languag:0,domain:0,main:0,admin:0,hook:0,relat:0,access:0,per:0,offici:0,work:0,document:0,commit_id:0,subscrib:0,pagin:0,paid:0,correct_scop:0,allow_failur:0,owner_nam:0,durat:0,open:0,titl:0,org:0,run:0,http:0,"0x02c26c48":0,respons:0,thei:0,get:0,bodi:0,point:0,provid:0,"int":0,abov:0,"__init__":0,segment:0,last_build_id:0,messag:0,fail:0,pull_request_numb:0,state:0,repo:0,"0x02c26c51":0,restart:0,object:0,none:0,your:0,hand:0,help:0,correct:0,directli:0,channel:0,all:0,have:0,specif:0,bug:0,authent:0,id_or_slug:0,avatar:0,pull_request:0,list:0,alreadi:0,servic:0,join:0,pusher:0,file:0,dict:0,even:0,api:0,primari:0,entity_class:0,on_py34:0,travispi:0,enterpris:0,kei:0,fork:0,maximum:0,enabl:0,later:0,pull_request_titl:0,"new":0,find_mani:0,influenc:0,line:0,you:0,administr:0,account_id:0,some:0,string:0,entity_id:0,first:0,filter:0,chang:0,entiti:0,current:0,retriev:0,github_auth:0,variabl:0,sourc:0,bool:0,finished_at:0,simpli:0,"import":0,valu:0,order:0,against:0,itself:0,fals:0,len:0,pip:0,easi:0,"final":0,internet:0,command:0,gpl:0,instanc:0,exampl:0,refer:0,more:0,mani:0,thi:0,organ:0,templat:0,welcom:0,started_at:0,member:0,come:0,error:0,event_typ:0,valid:0,github_languag:0,pleas:0,"true":0,comun:0,which:0,multipl:0,privileg:0,subscript:0,"default":0,finish:0,base:0,build_id:0,learn:0,free:0,find_on:0,after:0,owner:0,when:0,push:0,from:0,suppli:0,team:0,commit:0,recent:0,search:0,remov:0,last_build_dur:0,address:0,here:0,token:0,successfuli:0,can:0,uri:0,repositori:0,befor:0,detail:0,idea:0,possibl:0,like:0,answer:0,build:0,soon:0,method:0},titleterms:{quick:0,introduct:0,contribut:0,start:0,support:0,instal:0,"class":0,licens:0,constant:0},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","data","Python data"],"3":["py","method","Python method"],"4":["py","classmethod","Python class method"]},envversion:43,filenames:["index"]}) \ No newline at end of file +Search.setIndex({objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:classmethod","4":"py:data"},envversion:43,filenames:["index","entities","api","getting_started"],objects:{"":{travispy:[0,0,0,"-"]},"travispy.entities._entity":{Entity:[1,1,1,""]},"travispy.entities._restartable.Restartable":{cancel:[1,2,1,""],restart:[1,2,1,""]},travispy:{entities:[1,0,0,"-"],travispy:[2,0,0,"-"]},"travispy.travispy":{ENTERPRISE:[2,4,1,""],PRIVATE:[2,4,1,""],PUBLIC:[2,4,1,""],TravisPy:[2,1,1,""]},"travispy.entities":{"_entity":[1,0,0,"-"],Build:[1,1,1,""],Log:[1,1,1,""],Hook:[1,1,1,""],Repo:[1,1,1,""],Job:[1,1,1,""],Account:[1,1,1,""],"_restartable":[1,0,0,"-"],User:[1,1,1,""],Broadcast:[1,1,1,""]},"travispy.entities._entity.Entity":{many:[1,3,1,""],one:[1,3,1,""]},"travispy.travispy.TravisPy":{builds:[2,2,1,""],account:[2,2,1,""],broadcasts:[2,2,1,""],job:[2,2,1,""],log:[2,2,1,""],user:[2,2,1,""],github_auth:[2,3,1,""],hooks:[2,2,1,""],build:[2,2,1,""],accounts:[2,2,1,""],repos:[2,2,1,""],repo:[2,2,1,""],jobs:[2,2,1,""]},"travispy.entities._restartable":{Restartable:[1,1,1,""]}},titleterms:{support:0,api:2,travispi:0,introduct:[],contribut:0,quick:[],constant:[],"class":[],licens:0,instal:0,entiti:1,document:0,start:3,get:3},titles:["TravisPy","Entities","API","Getting started"],terms:{ani:[0,2],match:[],commit:1,itself:2,much:2,first:2,owner_nam:[1,2],entity_class:[],paid:2,synced_at:1,thi:[1,2,3],last_build_id:[1,3],"0x02c26c49":3,combin:2,after:2,confus:2,find_on:[],per:[1,2],gravatar_id:1,exampl:[1,2],object:[1,3],easi:3,scope:[1,3],come:1,provid:2,kei:1,"default":2,channel:1,creat:[0,1,2],sinc:2,domain:2,becom:0,internet:1,last_build_numb:1,follow:[0,3],cannot:2,dict:1,api:[],"return":[1,2,3],test:0,builtin:[],develop:0,bring:[1,2],"_restart":1,page:2,servic:2,run:2,"public":2,later:1,user:[1,2,3],perform:[],help:0,paramet:[1,2],join:0,repo_deploy:3,need:[0,2],send:[1,2],"new":0,befor:0,travispi:[1,3],gpl:0,remov:1,login:[1,2,3],doe:2,repo_hook:3,secur:1,take:0,last_build_finished_at:1,exactli:2,bool:[1,2],alwai:2,each:2,restart:[1,3],person:2,order:3,team:0,simpli:3,now:3,fetch:2,subscrib:1,log_id:[1,2],write:[0,3],idea:0,pagin:2,offici:[0,3],correct_scop:1,properli:2,job:[1,2],influenc:1,yml:1,just:3,like:2,entiti:[],pro:1,"0x02c26c48":3,see:2,represent:1,base:1,work:3,main:1,given:2,annot:1,pull_request_numb:1,even:2,method:[0,1],similar:0,free:[0,2],"_entiti":1,requir:[2,3],descript:1,push:2,request:[0,1,2,3],uri:2,token:[1,2,3],commit_id:1,last_build_dur:1,whether:[1,2],might:[1,2],click:0,list:[1,2,3],cancel:[1,2,3],avatar:1,build:[1,2,3],asap:0,"true":[1,2,3],pleas:[0,3],includ:2,inform:[1,2,3],respons:[1,2],found:2,someth:2,alreadi:3,detail:3,about:[1,2,3],state:[1,2],number:[1,2],address:1,fork:0,all:[0,1,2,3],log:[1,2,3],org:[2,3],some:2,created_at:1,config:1,len:3,last:1,thei:0,classmethod:[1,2],repo:[1,2,3],file:1,your_github_token:3,usag:2,error:2,ssh:1,access:[1,2,3],exist:2,pip:0,"0x02c26c51":3,maximum:2,languag:1,bug:0,on_py34:3,want:[0,2,3],separ:2,enabl:2,librari:3,administr:1,you:[0,2,3],point:1,relat:[0,2,3],until:0,fail:2,must:3,bodi:1,valu:[1,2],last_build_st:1,privileg:1,pass:2,github_auth:[2,3],comun:2,segment:2,python:0,where:2,search:2,primari:1,execut:1,find_mani:[],from:[1,3],session:[1,2],member:[2,3],correspond:[1,2],event:2,started_at:1,string:1,sourc:[1,2],document:[1,3],retriev:[],either:2,directli:[1,2],"import":3,finished_at:1,"int":[1,2],titl:1,type:[1,2],correct:1,link:2,com:2,http:2,issu:0,time:1,recent:[2,3],repository_id:[1,2],usual:[1,2],avail:[1,3],read:3,repos_count:1,allow_failur:1,feel:0,pusher:1,action:1,github_languag:1,your:[0,2,3],other:2,get:[],line:0,queue:[1,2],which:[1,3],answer:0,job_id:[1,2],repositori:[1,2,3],github:[0,1,2,3],belong:2,enterpris:2,is_sync:1,privat:[1,2],chang:0,under:[0,2],implement:0,instanc:2,account_id:2,pull_request:[1,2],profil:2,term:2,id_or_slug:2,against:3,open:0,limit:2,owner:[1,2],organ:[1,2],durat:1,activ:[1,2,3],suppli:2,fals:[2,3],entity_id:[],str:[1,2],kwarg:2,after_numb:2,specif:3,rubi:0,"0x02c26c50":3,command:0,last_build_started_at:1,possibl:[0,2],when:1,full:0,statu:3,filter:2,handl:2,onli:[1,2],messag:1,"__init__":2,can:[0,2,3],have:[1,2,3],broadcast:[1,2],authent:[2,3],email:[1,3],account:[1,2],experiment:0,learn:3,hook:[1,2],name:[1,2],make:0,valid:1,build_id:[1,2],sync:1,subscript:1,here:0,welcom:0,more:3,travi:[0,1,2,3],merg:0,successfuli:1,pull:[0,1],templat:2,hand:3,mani:1,soon:3,refer:[0,3],local:1,annotation_id:1,singl:1,multipl:1,variabl:1,none:2,matrix:1,"final":3,pull_request_titl:1,event_typ:2,abov:2,current:[1,2,3],slug:[1,2,3],jod:1,obtain:2,admin:[1,2],finish:1},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","classmethod","Python class method"],"4":["py","data","Python data"]}}) \ No newline at end of file diff --git a/docs/api.rst b/docs/api.rst new file mode 100644 index 0000000..23cd9b8 --- /dev/null +++ b/docs/api.rst @@ -0,0 +1,19 @@ +.. |travispy| replace:: **TravisPy** +.. |travisci| replace:: *Travis CI* +.. |github| replace:: *GitHub* + +.. _official API: http://docs.travis-ci.com/api/ +.. _Ruby: https://github.com/travis-ci/travis.rb#ruby-library +.. _requirement: http://docs.travis-ci.com/api/#external-apis +.. _access token: https://github.com/settings/applications +.. _entities: http://docs.travis-ci.com/api/#entities +.. _open issues: https://github.com/menegazzo/travispy/issues?state=open + +=== +API +=== + +This document brings the public API of |travispy|. + +.. automodule:: travispy.travispy + :no-show-inheritance: diff --git a/docs/entities.rst b/docs/entities.rst new file mode 100644 index 0000000..5e9d17e --- /dev/null +++ b/docs/entities.rst @@ -0,0 +1,43 @@ +.. |travispy| replace:: **TravisPy** +.. |travisci| replace:: *Travis CI* +.. |github| replace:: *GitHub* + +.. _official API: http://docs.travis-ci.com/api/ +.. _Ruby: https://github.com/travis-ci/travis.rb#ruby-library +.. _requirement: http://docs.travis-ci.com/api/#external-apis +.. _access token: https://github.com/settings/applications +.. _entities: http://docs.travis-ci.com/api/#entities +.. _open issues: https://github.com/menegazzo/travispy/issues?state=open + +======== +Entities +======== + +This document brings information about all entities that are used by |travispy| API. + +.. autoclass:: Session + :no-show-inheritance: + +.. module:: travispy.entities._entity +.. autoclass:: Entity + :no-show-inheritance: + +.. module:: travispy.entities._restartable +.. autoclass:: Restartable + +.. module:: travispy.entities +.. autoclass:: Account + +.. autoclass:: Broadcast + +.. autoclass:: Build + +.. autoclass:: Hook + +.. autoclass:: Job + +.. autoclass:: Log + +.. autoclass:: Repo + +.. autoclass:: User diff --git a/docs/getting_started.rst b/docs/getting_started.rst new file mode 100644 index 0000000..7d1d376 --- /dev/null +++ b/docs/getting_started.rst @@ -0,0 +1,68 @@ +.. |travispy| replace:: **TravisPy** +.. |travisci| replace:: *Travis CI* +.. |github| replace:: *GitHub* + +.. _official API: http://docs.travis-ci.com/api/ +.. _Ruby: https://github.com/travis-ci/travis.rb#ruby-library +.. _requirement: http://docs.travis-ci.com/api/#external-apis +.. _access token: https://github.com/settings/applications +.. _entities: http://docs.travis-ci.com/api/#entities +.. _open issues: https://github.com/menegazzo/travispy/issues?state=open + +=============== +Getting started +=============== + +|travispy| works just as |travisci|: 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() + >>> user = t.user() + >>> user + + +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[0] + + >>> repos[0].slug + 'travispy/on_py34' + +Or simply request for repository you want:: + + >>> repo = r.repo('travispy/on_py34') + + +And finally, getting build information:: + + >>> build = t.build(repo.last_build_id) + >>> build + + >>> build.restart() + True + >>> build.cancel() + True + >>> build.cancel() # As build was already cancelled it will return False. + 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. diff --git a/docs/index.rst b/docs/index.rst index c3f6164..1b54222 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,8 +1,3 @@ -.. TravisPy documentation master file, created by - sphinx-quickstart on Wed Jul 2 10:35:41 2014. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - .. |travispy| replace:: **TravisPy** .. |travisci| replace:: *Travis CI* .. |github| replace:: *GitHub* @@ -14,8 +9,9 @@ .. _entities: http://docs.travis-ci.com/api/#entities .. _open issues: https://github.com/menegazzo/travispy/issues?state=open -Introduction -============ +======== +TravisPy +======== .. automodule:: travispy @@ -26,102 +22,15 @@ To install |travispy| all it takes is one command line:: pip install travispy -Quick start -=========== - -|travispy| works just as |travisci|: 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() - >>> user = t.user() - >>> user - - -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[0] - - >>> repos[0].slug - 'travispy/on_py34' - -Or simply request for repository you want:: - - >>> repo = r.repo('travispy/on_py34') - - -And finally, getting build information:: - - >>> build = t.build(repo.last_build_id) - >>> build - - >>> build.restart() - True - >>> build.cancel() - True - >>> build.cancel() # As build was already cancelled it will return False. - 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. - -Constants -========= - -.. automodule:: travispy.travispy - :no-members: - -Classes -======= - -.. module:: travispy.travispy -.. autoclass:: TravisPy - :no-show-inheritance: - -.. autoclass:: Session - :no-show-inheritance: - -.. module:: travispy.entities._entity -.. autoclass:: Entity - :no-show-inheritance: - -.. module:: travispy.entities._restartable -.. autoclass:: Restartable - -.. module:: travispy.entities -.. autoclass:: Account - -.. autoclass:: Broadcast - -.. autoclass:: Build - -.. autoclass:: Hook - -.. autoclass:: Job - -.. autoclass:: Log - -.. autoclass:: Repo +Documentation +============= -.. autoclass:: User +.. toctree:: + :maxdepth: 2 + + getting_started + api + entities Support =======