jacquev6/PyGithub — pull request #189 by akfish (2013-08-16 11:57:32+00:00)
Title: Add Conditional Request and Data Persistence Support 

Chang List
---------------
1. Add support to [Conditional Request](http://developer.github.com/guides/getting-started/#conditional-requests) API.
* Add ```GithubObject.etag``` property
* Add ```GithubObject.last_modified``` property
* Modify ```Requester``` class to retreive ```ETag, Last-Modified``` response header values and store in ```raw_data```
* Modify ```Requester``` class to enable making conditional request
* Add ```NotModifiedException``` class
* Add ```CompletableGithubObject.update()``` method
* Add a few private helper methods to make this work
2. Add methods for Data Persistence
* Add ```GithubObject.save(file_fname)``` method
* Add ```GithubObject.load(file_fname)``` class method

Example
---------------

I am working on a project ([git-issue](https://github.com/akfish/git-issue)) to add issue tracking extension to Git. It syncs with GitHub's issue tracker. Local caching and update check is essential for performance and usability. With these modification, an workflow like below can be implemented:

```
# Get remote issue list and cache locally when syncing
for issue in repo.get_issues():
issue.save(local_file_path)

# Offline use/Quick restore previous work state
for local_file_path in cache.get_files():
cached_issue = issue.load(local_file_path)
#do something with it

# And check for update when needed
if (cached_issue.update()):
print "Issue synced“

```
This will help avoiding expensive and slow network requests when they are not necessarily required.