Skip to content

Commit c2104b5

Browse files
committed
Link to usage docs in README, and remove duplicated content.
1 parent 114f2e2 commit c2104b5

1 file changed

Lines changed: 2 additions & 303 deletions

File tree

README.rst

Lines changed: 2 additions & 303 deletions
Original file line numberDiff line numberDiff line change
@@ -12,310 +12,9 @@ available in version 2 of the `Github API`_.
1212
*Note* This software is not finished. And is likely to change in the near
1313
future.
1414

15-
.. _`Github API`: http://develop.github.com/
16-
17-
Introduction
18-
============
19-
20-
You should read the developer documentation for the `Github API`_ first.
21-
22-
Installation
23-
------------
24-
25-
You can install ``python-github2`` either via the Python Package Index (PyPI)
26-
or from source.
27-
28-
To install using ``pip``::
29-
30-
$ pip install github2
31-
32-
To install using ``easy_install``::
33-
34-
$ easy_install github2
35-
36-
If you have downloaded a source tarball you can install it
37-
by doing the following::
38-
39-
$ python setup.py build
40-
# python setup.py install # as root
41-
42-
Creating a client
43-
------------------
44-
45-
There are three ways to authenticate to the GitHub API. If you want to use your
46-
username and API token, use::
47-
48-
>>> from github2.client import Github
49-
>>> github = Github(username="ask", api_token=".......")
50-
51-
If you authenticated to GitHub using their OAuth service, pass in the OAuth
52-
access token::
53-
54-
>>> github = Github(access_token="........")
55-
56-
Or for an unauthenticated connection::
57-
58-
>>> github = Github()
59-
60-
The package supports caching of GitHub responses by adding a ``cache`` keyword
61-
during setup::
62-
63-
>>> github = Github(username="ask", api_token=".......", cache="cache_dir")
64-
65-
API calls are limited by github.com to 1 per second by default. To have the
66-
Github client enforce this and avoid rate limit errors, pass requests_per_second
67-
in::
68-
69-
>>> from github2.client import Github
70-
>>> github = Github(username="ask", api_token=".......",
71-
... requests_per_second=1)
72-
73-
Users
74-
=====
75-
76-
Searching
77-
---------
78-
79-
>>> results = github.users.search("foo")
80-
81-
Getting User Information
82-
------------------------
83-
84-
>>> user = github.users.show("ask")
85-
>>> user.name
86-
"Ask Solem"
87-
88-
Getting User Network
89-
---------------------
90-
91-
>>> github.users.followers("ask")
92-
['greut', 'howiworkdaily', 'emanchado', 'webiest']
93-
94-
>>> github.users.following("ask")
95-
['sverrejoh',
96-
'greut',
97-
'jezdez',
98-
'bradleywright',
99-
'ericflo',
100-
'howiworkdaily',
101-
'emanchado',
102-
'traviscline',
103-
'russell']
104-
105-
Following Network
106-
------------------
107-
108-
>>> github.users.follow("jezdez")
109-
110-
>>> github.users.unfollow("jezdez")
111-
112-
Issues
113-
======
114-
115-
List a Projects Issues
116-
----------------------
117-
118-
>>> github.issues.list("ask/chishop", state="open")
119-
>>> github.issues.list("ask/chishop", state="closed")
120-
121-
Search a Projects Issues
122-
------------------------
123-
124-
>>> issues = github.issues.search("ask/chishop", "version twice")
125-
>>> issues[0].title
126-
'Upload hangs on attempted second file.'
127-
128-
>>> github.issues.search("ask/chishop", term="authorization",
129-
... state="closed")
130-
131-
View an Issue
132-
-------------
133-
134-
>>> issue = github.issues.show("ask/chishop", 1)
135-
>>> issue.title
136-
'Should not be able to upload same version twice.'
137-
138-
View Comments on an Issue
139-
-------------------------
140-
>>> comments = github.issues.comments("ask/chishop", 5)
141-
>>> comments[0].body
142-
'Fix merged into /ask branch.'
143-
144-
Open and Close Issues
145-
---------------------
146-
147-
>>> new_issue = github.issues.open("ask/chishop", title="New bug",
148-
... body="This is a test bug")
149-
>>> new_issue.number
150-
2
151-
152-
>>> github.issues.close("ask/chishop", new_issue.number)
153-
>>> github.issues.reopen("ask/chishop", new_issue.number)
154-
155-
List Labels
156-
-----------
157-
158-
>>> github.issues.list_labels("ask/chisop")
159-
[u'TODO', u'ask']
160-
>>> github.issues.list_by_label("ask/chishop", "TODO")
161-
[<Issue: Should not be able to upload same version twice.>]
162-
163-
Add and Remove Labels
164-
---------------------
165-
166-
>>> github.issues.add_label("ask/chishop", 2, "important")
167-
168-
>>> github.issues.remove_label("ask/chishop", 2, "important")
169-
170-
Edit an Issue
171-
-------------
172-
173-
>>> github.issues.edit("ask/chishop", 3, title="New title",
174-
... body="New body")
175-
176-
Network
177-
=======
178-
179-
Network Meta
180-
-------------
181-
182-
>>> github.get_network_meta("ask/chishop")
183-
184-
Network Data
185-
------------
186-
187-
>>> github.get_network_data("schacon/simplegit",
188-
... nethash="fa8fe264b926cdebaab36420b6501bd74402a6ff")
189-
190-
191-
Repository
192-
==========
193-
194-
Searching Repositories
195-
----------------------
196-
197-
>>> repositories = github.repos.search("django")
198-
199-
200-
Show Repo Info
201-
--------------
202-
203-
>>> repo = github.repos.show("schacon/grit")
204-
>>> repo.homepage
205-
"http://grit.rubyforge.org/"
206-
207-
List All Repositories
208-
---------------------
209-
210-
# By default lists all repos for the current user.
211-
>>> repos = github.repos.list()
212-
213-
>>> repos = github.repos.list("schacon")
214-
215-
Watching Repositories
216-
---------------------
217-
218-
>>> github.repos.watch("schacon/grit")
219-
220-
>>> github.repos.unwatch("schacon/grit")
221-
222-
Forking Repositories
223-
--------------------
224-
225-
>>> fork = github.repos.fork("schacon/grit")
226-
227-
Creating and Deleting Repositories
228-
----------------------------------
229-
230-
>>> new_repo = github.repos.create(name, description, homepage,
231-
... public=True)
232-
233-
>>> github.repos.delete(name)
234-
235-
Repository Visibility
236-
---------------------
237-
238-
>>> github.repos.set_private("ask/chishop")
239-
240-
>>> github.repos.set_public("ask/chishop")
241-
242-
Pushable repositories
243-
---------------------
244-
245-
>>> pushables = github.repos.pushable()
246-
247-
Collaborators
248-
-------------
249-
250-
>>> collabs = github.repos.list_collaborators("ask/chishop")
251-
252-
>>> github.repos.add_collaborator("ask/chishop", "schacon")
253-
254-
>>> github.repos.remove_collaborator("ask/chishop", "schacon")
255-
256-
Watchers
257-
-------------
258-
259-
>>> watchers = github.repos.watchers("ask/chishop")
260-
261-
262-
Network
263-
-------
264-
265-
>>> github.repos.network("ask/chishop")
266-
267-
Repository Refs
268-
---------------
269-
270-
Get a list of tags
271-
272-
>>> tags = github.repos.tags("ask/chishop")
273-
274-
Get a list of remote branches
275-
276-
>>> branches = github.repos.branches("ask/chishop")
277-
278-
279-
Commit
280-
======
281-
282-
Listing Commits on a Branch
283-
----------------------------
284-
285-
>>> commits = github.commits.list("mojombo/grit", "master")
286-
287-
288-
Listing Commits for a File
289-
--------------------------
290-
291-
>>> commits = github.commits.list("mojombo/grit", "master",
292-
... file="grit.gemspec")
293-
294-
Showing a Specific Commit
295-
-------------------------
296-
297-
>>> commit = github.commits.show("mojombo/grit",
298-
... sha="5071bf9fbfb81778c456d62e111440fdc776f76c")
299-
300-
301-
Object
302-
======
303-
304-
Trees
305-
-----
306-
307-
>>> tree = github.get_tree(project, tree_sha)
308-
309-
Blobs
310-
-----
311-
312-
>>> blob = github.get_blob_info(project, tree_sha, path)
313-
314-
All Blobs
315-
---------
316-
317-
>>> blobs = github.get_all_blobs(project, tree_sha)
15+
See the ``doc/`` directory for installation instructions and usage information.
31816

17+
.. _Github API: http://develop.github.com/
31918

32019
License
32120
=======

0 commit comments

Comments
 (0)