[diffoscope] 01/01: bin/trydiffoscope: Move to version 2 of API, don't continue to poll on error
Chris Lamb
chris at chris-lamb.co.uk
Thu Aug 4 20:44:17 CEST 2016
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository diffoscope.
commit d8054584c38624e3985ea57b1e15d69208ed145e
Author: Chris Lamb <lamby at debian.org>
Date: Thu Aug 4 19:42:35 2016 +0100
bin/trydiffoscope: Move to version 2 of API, don't continue to poll on error
---
bin/trydiffoscope | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/bin/trydiffoscope b/bin/trydiffoscope
index aa931d1..bf14927 100755
--- a/bin/trydiffoscope
+++ b/bin/trydiffoscope
@@ -36,17 +36,22 @@ class TryDiffoscope(object):
})
response.raise_for_status()
+ status_url = response.json()['url']
- url = response.json()['url']
-
- while self.args.poll:
- time.sleep(1)
- response = requests.head(url)
+ while True:
+ response = requests.get(status_url)
response.raise_for_status()
- if response.status_code == 302:
+ url = response.json()['url']
+
+ if not self.args.poll:
break
+ if response.json()['state'] not in ('queued', 'running'):
+ break
+
+ time.sleep(1)
+
print(url)
if self.args.webbrowser:
@@ -67,7 +72,7 @@ if __name__ == '__main__':
parser.add_argument(
'--url',
help="Use this trydiffoscope endpoint (for development)",
- default='https://try.diffoscope.org/api/v1/compare',
+ default='https://try.diffoscope.org/api/v2/comparison',
)
parser.add_argument(
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the diffoscope
mailing list