-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding vendored uritemplate, background queue for getting data from g…
…ithub
- Loading branch information
1 parent
c26f4b9
commit d15863d
Showing
55 changed files
with
4,794 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,9 @@ handlers: | |
- url: /.* | ||
script: zenchart.app | ||
|
||
builtins: | ||
- deferred: on | ||
|
||
libraries: | ||
- name: jinja2 | ||
version: latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from urllib2 import Request, urlopen, URLError | ||
import base64, json | ||
import datetime, time | ||
import logging | ||
from model import Issue | ||
# Get vendored uritemplate module | ||
from google.appengine.ext import vendor | ||
vendor.add('lib') | ||
import uritemplate | ||
|
||
githubUrl = 'https://api.github.com/repos' | ||
|
||
def getJson(repo, url): | ||
if githubUrl not in url: | ||
url = githubUrl + '/' + repo.name + url | ||
logging.info('github GET ' + url) | ||
request = Request(url) | ||
encoded = base64.b64encode('%s:%s' % (repo.auth.githubUser, repo.auth.githubToken)) | ||
request.add_header('Authorization', 'Basic ' + encoded) | ||
return json.load(urlopen(request)) | ||
|
||
def getAllPages(repo, url): | ||
pageSize = 50 | ||
pageNumber = 0 | ||
items = [] | ||
more = True | ||
if '?' not in url: | ||
url += '?' | ||
else: | ||
url += '&' | ||
while more: | ||
fetchUrl = url + 'per_page=%d&page=%d' % (pageSize, pageNumber) | ||
page = getJson(repo, fetchUrl) | ||
items.extend(page) | ||
pageNumber += 1 | ||
more = len(page) == pageSize | ||
return items | ||
|
||
def syncIssues(repo): | ||
# Determine the most recently updated issue | ||
latest = None | ||
for issue in repo.issues(): | ||
if not latest or latest < issue.github['']: | ||
logging.info("???") | ||
|
||
def getIssueEvents(repo, issue): | ||
events = getAllPages(repo, issue.github['events_url']) | ||
logging.info('Found %d events for #%s' % (len(events),issue.number)) | ||
issue.github['events'] = events | ||
|
||
def getAllIssues(repo): | ||
# Update the repo with content | ||
repo.data = getJson(repo, '') | ||
repo.put() | ||
|
||
logging.info(uritemplate.expand(repo.data['issues_url'], {})) | ||
|
||
issueUrl = uritemplate.expand(repo.data['issues_url'], {}) | ||
issueUrl += '?state=all' | ||
issues = getAllPages(repo, issueUrl) | ||
for issueData in issues: | ||
issue = Issue(repo = repo.key, github = issueData, number = issueData['number']) | ||
getIssueEvents(repo, issue) | ||
issue.upsert() | ||
|
||
#logging.info(json.dumps(repo.data, indent=2)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
{% extends "base.html" %} | ||
{% block body %} | ||
<h1><a href="/">Home</a> >> {{ repo.name }}<h1> | ||
|
||
<h1><a href="/">Home</a> → {{ repo.name }}</h1> | ||
{% if issues %} | ||
<ul> | ||
{% for issue in issues %} | ||
<li>{{ issue.number }} - {{ issue.github['state'] }} - {{ issue.github['events']|length }} events</li> | ||
{% endfor %} | ||
</ul> | ||
{% else %} | ||
<p>No issues</p> | ||
{% endif %} | ||
<form action="{{ repo.url() + '/sync' }}" method="post"> | ||
<div><input type="submit" value="Sync this repo"></div> | ||
</form> | ||
|
||
<form action="{{ repo.url() + '/delete' }}" method="post"> | ||
<div><input type="submit" value="Delete this repo"></div> | ||
<form> | ||
</form> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
Metadata-Version: 1.1 | ||
Name: simplejson | ||
Version: 3.8.2 | ||
Summary: Simple, fast, extensible JSON encoder/decoder for Python | ||
Home-page: http://github.com/simplejson/simplejson | ||
Author: Bob Ippolito | ||
Author-email: [email protected] | ||
License: MIT License | ||
Description: simplejson is a simple, fast, complete, correct and extensible | ||
JSON <http://json.org> encoder and decoder for Python 2.5+ | ||
and Python 3.3+. It is pure Python code with no dependencies, | ||
but includes an optional C extension for a serious speed boost. | ||
|
||
The latest documentation for simplejson can be read online here: | ||
http://simplejson.readthedocs.org/ | ||
|
||
simplejson is the externally maintained development version of the | ||
json library included with Python 2.6 and Python 3.0, but maintains | ||
backwards compatibility with Python 2.5. | ||
|
||
The encoder can be specialized to provide serialization in any kind of | ||
situation, without any special support by the objects to be serialized | ||
(somewhat like pickle). This is best done with the ``default`` kwarg | ||
to dumps. | ||
|
||
The decoder can handle incoming JSON strings of any specified encoding | ||
(UTF-8 by default). It can also be specialized to post-process JSON | ||
objects with the ``object_hook`` or ``object_pairs_hook`` kwargs. This | ||
is particularly useful for implementing protocols such as JSON-RPC | ||
that have a richer type system than JSON itself. | ||
|
||
For those of you that have legacy systems to maintain, there is a | ||
very old fork of simplejson in the `python2.2`_ branch that supports | ||
Python 2.2. This is based off of a very old version of simplejson, | ||
is not maintained, and should only be used as a last resort. | ||
|
||
.. _python2.2: https://github.com/simplejson/simplejson/tree/python2.2 | ||
|
||
Platform: any | ||
Classifier: Development Status :: 5 - Production/Stable | ||
Classifier: Intended Audience :: Developers | ||
Classifier: License :: OSI Approved :: MIT License | ||
Classifier: License :: OSI Approved :: Academic Free License (AFL) | ||
Classifier: Programming Language :: Python | ||
Classifier: Programming Language :: Python :: 2 | ||
Classifier: Programming Language :: Python :: 2.5 | ||
Classifier: Programming Language :: Python :: 2.6 | ||
Classifier: Programming Language :: Python :: 2.7 | ||
Classifier: Programming Language :: Python :: 3 | ||
Classifier: Programming Language :: Python :: 3.3 | ||
Classifier: Programming Language :: Python :: 3.4 | ||
Classifier: Programming Language :: Python :: Implementation :: CPython | ||
Classifier: Programming Language :: Python :: Implementation :: PyPy | ||
Classifier: Topic :: Software Development :: Libraries :: Python Modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
CHANGES.txt | ||
LICENSE.txt | ||
MANIFEST.in | ||
README.rst | ||
conf.py | ||
index.rst | ||
setup.cfg | ||
setup.py | ||
scripts/artifacts.py | ||
scripts/make_docs.py | ||
simplejson/__init__.py | ||
simplejson/_speedups.c | ||
simplejson/compat.py | ||
simplejson/decoder.py | ||
simplejson/encoder.py | ||
simplejson/ordered_dict.py | ||
simplejson/scanner.py | ||
simplejson/tool.py | ||
simplejson.egg-info/PKG-INFO | ||
simplejson.egg-info/SOURCES.txt | ||
simplejson.egg-info/dependency_links.txt | ||
simplejson.egg-info/top_level.txt | ||
simplejson/tests/__init__.py | ||
simplejson/tests/test_bigint_as_string.py | ||
simplejson/tests/test_bitsize_int_as_string.py | ||
simplejson/tests/test_check_circular.py | ||
simplejson/tests/test_decimal.py | ||
simplejson/tests/test_decode.py | ||
simplejson/tests/test_default.py | ||
simplejson/tests/test_dump.py | ||
simplejson/tests/test_encode_basestring_ascii.py | ||
simplejson/tests/test_encode_for_html.py | ||
simplejson/tests/test_errors.py | ||
simplejson/tests/test_fail.py | ||
simplejson/tests/test_float.py | ||
simplejson/tests/test_for_json.py | ||
simplejson/tests/test_indent.py | ||
simplejson/tests/test_item_sort_key.py | ||
simplejson/tests/test_iterable.py | ||
simplejson/tests/test_namedtuple.py | ||
simplejson/tests/test_pass1.py | ||
simplejson/tests/test_pass2.py | ||
simplejson/tests/test_pass3.py | ||
simplejson/tests/test_recursion.py | ||
simplejson/tests/test_scanstring.py | ||
simplejson/tests/test_separators.py | ||
simplejson/tests/test_speedups.py | ||
simplejson/tests/test_subclass.py | ||
simplejson/tests/test_tool.py | ||
simplejson/tests/test_tuple.py | ||
simplejson/tests/test_unicode.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
../simplejson/compat.py | ||
../simplejson/scanner.py | ||
../simplejson/ordered_dict.py | ||
../simplejson/encoder.py | ||
../simplejson/decoder.py | ||
../simplejson/__init__.py | ||
../simplejson/tool.py | ||
../simplejson/tests/test_pass1.py | ||
../simplejson/tests/test_speedups.py | ||
../simplejson/tests/test_encode_for_html.py | ||
../simplejson/tests/test_separators.py | ||
../simplejson/tests/test_indent.py | ||
../simplejson/tests/test_iterable.py | ||
../simplejson/tests/test_decimal.py | ||
../simplejson/tests/test_item_sort_key.py | ||
../simplejson/tests/test_pass2.py | ||
../simplejson/tests/test_unicode.py | ||
../simplejson/tests/test_scanstring.py | ||
../simplejson/tests/test_for_json.py | ||
../simplejson/tests/test_check_circular.py | ||
../simplejson/tests/test_default.py | ||
../simplejson/tests/test_subclass.py | ||
../simplejson/tests/test_errors.py | ||
../simplejson/tests/test_dump.py | ||
../simplejson/tests/test_tool.py | ||
../simplejson/tests/test_bitsize_int_as_string.py | ||
../simplejson/tests/test_recursion.py | ||
../simplejson/tests/test_bigint_as_string.py | ||
../simplejson/tests/__init__.py | ||
../simplejson/tests/test_namedtuple.py | ||
../simplejson/tests/test_decode.py | ||
../simplejson/tests/test_encode_basestring_ascii.py | ||
../simplejson/tests/test_fail.py | ||
../simplejson/tests/test_float.py | ||
../simplejson/tests/test_pass3.py | ||
../simplejson/tests/test_tuple.py | ||
../simplejson/compat.pyc | ||
../simplejson/scanner.pyc | ||
../simplejson/ordered_dict.pyc | ||
../simplejson/encoder.pyc | ||
../simplejson/decoder.pyc | ||
../simplejson/__init__.pyc | ||
../simplejson/tool.pyc | ||
../simplejson/tests/test_pass1.pyc | ||
../simplejson/tests/test_speedups.pyc | ||
../simplejson/tests/test_encode_for_html.pyc | ||
../simplejson/tests/test_separators.pyc | ||
../simplejson/tests/test_indent.pyc | ||
../simplejson/tests/test_iterable.pyc | ||
../simplejson/tests/test_decimal.pyc | ||
../simplejson/tests/test_item_sort_key.pyc | ||
../simplejson/tests/test_pass2.pyc | ||
../simplejson/tests/test_unicode.pyc | ||
../simplejson/tests/test_scanstring.pyc | ||
../simplejson/tests/test_for_json.pyc | ||
../simplejson/tests/test_check_circular.pyc | ||
../simplejson/tests/test_default.pyc | ||
../simplejson/tests/test_subclass.pyc | ||
../simplejson/tests/test_errors.pyc | ||
../simplejson/tests/test_dump.pyc | ||
../simplejson/tests/test_tool.pyc | ||
../simplejson/tests/test_bitsize_int_as_string.pyc | ||
../simplejson/tests/test_recursion.pyc | ||
../simplejson/tests/test_bigint_as_string.pyc | ||
../simplejson/tests/__init__.pyc | ||
../simplejson/tests/test_namedtuple.pyc | ||
../simplejson/tests/test_decode.pyc | ||
../simplejson/tests/test_encode_basestring_ascii.pyc | ||
../simplejson/tests/test_fail.pyc | ||
../simplejson/tests/test_float.pyc | ||
../simplejson/tests/test_pass3.pyc | ||
../simplejson/tests/test_tuple.pyc | ||
../simplejson/_speedups.so | ||
./ | ||
PKG-INFO | ||
SOURCES.txt | ||
top_level.txt | ||
dependency_links.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
simplejson |
Oops, something went wrong.