Mercurial > bzapi
changeset 33:97e681243579
updated readme and made example.py run only when it is the main script
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Thu, 24 Dec 2009 14:38:28 -0800 |
parents | 9748d997cbf7 |
children | b4fab248d1eb |
files | README.txt example.py |
diffstat | 2 files changed, 29 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/README.txt Thu Dec 24 14:33:51 2009 -0800 +++ b/README.txt Thu Dec 24 14:38:28 2009 -0800 @@ -4,6 +4,6 @@ Then run: - nosetests . + nosetests --with-doctest Otherwise, you're on your own.
--- a/example.py Thu Dec 24 14:33:51 2009 -0800 +++ b/example.py Thu Dec 24 14:38:28 2009 -0800 @@ -5,35 +5,39 @@ import pymongo import bzapi -logging.basicConfig(level=logging.DEBUG) +def run(): + logging.basicConfig(level=logging.DEBUG) -connection = pymongo.Connection('localhost', 27017) -db = connection.bzapi_example_db + connection = pymongo.Connection('localhost', 27017) + db = connection.bzapi_example_db -api = bzapi.BugzillaApi( - base_url = 'https://api-dev.bugzilla.mozilla.org/latest', - collection = db.api - ) + api = bzapi.BugzillaApi( + base_url = 'https://api-dev.bugzilla.mozilla.org/latest', + collection = db.api + ) -#db.bugs.remove({}) + #db.bugs.remove({}) -search = bzapi.CachedSearch( - api = api, - collection = db.bugs, - changed_after='2009-12-20T12:00:00Z', - product='Mozilla Labs', - component='Jetpack' - ) + search = bzapi.CachedSearch( + api = api, + collection = db.bugs, + changed_after='2009-12-20T12:00:00Z', + product='Mozilla Labs', + component='Jetpack' + ) + + search.update() + #print search.bugs.find_one({'id': '536619'}) -search.update() -#print search.bugs.find_one({'id': '536619'}) + #print len([bug for bug in search.bugs.itervalues()]) -#print len([bug for bug in search.bugs.itervalues()]) + #print search.bugs.values()[12] + + #print api.get('/bug/510339/history') -#print search.bugs.values()[12] - -#print api.get('/bug/510339/history') + #print api.get('/bug', + # product='Mozilla Labs', component='Jetpack', + # changed_after=now-timedelta(minutes=60)) -#print api.get('/bug', -# product='Mozilla Labs', component='Jetpack', -# changed_after=now-timedelta(minutes=60)) +if __name__ == '__main__': + run()