Skip to content

Commit fce7cea

Browse files
committed
Fix version and some docs omissions
1 parent 5f07230 commit fce7cea

3 files changed

Lines changed: 40 additions & 19 deletions

File tree

docs/examples/iterators.rst

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ The problem is that you will then have to reiterate over all of the users each
2020
time you want to get the new users. You have two approaches you can take to
2121
avoid this with :class:`GitHubIterator <github3.structs.GitHubIterator>`.
2222

23-
The First Approach
24-
------------------
25-
2623
You can not call the method directly in the for-loop and keep the iterator as
2724
a separate reference like so:
2825

@@ -33,6 +30,9 @@ a separate reference like so:
3330
for u in i:
3431
add_user_to_database(u)
3532
33+
The First Approach
34+
------------------
35+
3636
Then after your first pass through your ``GitHubIterator`` object will have an
3737
attribute named ``etag``. After you've added all the currently existing users
3838
you could do the following to retrieve the new users in a timely fashion:
@@ -48,6 +48,24 @@ you could do the following to retrieve the new users in a timely fashion:
4848
4949
time.sleep(120) # Sleep for 2 minutes
5050
51-
If there are no new users, this won't impact your ratelimit at all. This
52-
mimics the ability to conditionally refresh data on almost all other objects
53-
in github3.py.
51+
The Second Approach
52+
-------------------
53+
54+
.. code-block:: python
55+
56+
etag = i.etag
57+
# Store this somewhere
58+
59+
# Later when you start a new process or go to check for new users you can
60+
# then do
61+
62+
i = g.iter_all_users(etag=etag)
63+
64+
for u in i:
65+
add_user_to_database(u)
66+
67+
------
68+
69+
If there are no new users, these approaches won't impact your ratelimit at
70+
all. This mimics the ability to conditionally refresh data on almost all other
71+
objects in github3.py.

docs/structs.rst

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
.. module:: github3
22
.. module:: github3.structs
33

4-
Structures developed for github3.py
5-
===================================
4+
Structures
5+
==========
66

7-
As of right now, there exists only one class in this file, and it is of only
8-
limited importance to users of github3.py. The :class:`GitHubIterator` class
9-
is used to return the results of calls to almost all of the calls to ``iter_``
10-
methods on objects. When conditional refreshing was added to objects, there
11-
was a noticable gap in having conditional calls to those ``iter_`` methods.
12-
GitHub provides the proper headers on those calls, but there was no easy way
13-
to add that to what github3.py returned so it could be used properly. This was
14-
the best compromise - an object the behaves like an iterator regardless but
15-
can also be ``refresh``\ ed to get results since the last request
16-
conditionally.
7+
Developed for github3.py
8+
------------------------
9+
10+
As of right now, there exists only one class in this section, and it is of
11+
only limited importance to users of github3.py. The :class:`GitHubIterator`
12+
class is used to return the results of calls to almost all of the calls to
13+
``iter_`` methods on objects. When conditional refreshing was added to
14+
objects, there was a noticable gap in having conditional calls to those
15+
``iter_`` methods. GitHub provides the proper headers on those calls, but
16+
there was no easy way to add that to what github3.py returned so it could be
17+
used properly. This was the best compromise - an object the behaves like an
18+
iterator regardless but can also be ``refresh``\ ed to get results since the
19+
last request conditionally.
1720

1821
Objects
1922
-------

github3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
__author__ = 'Ian Cordasco'
1414
__license__ = 'Modified BSD'
1515
__copyright__ = 'Copyright 2012-2013 Ian Cordasco'
16-
__version__ = '0.5.3'
16+
__version__ = '0.6.0.b'
1717

1818
from github3.api import *
1919
from github3.github import GitHub, GitHubEnterprise, GitHubStatus

0 commit comments

Comments
 (0)