[diffoscope] 01/01: bin/trydiffoscope: Optionally poll locally until result is available.

Chris Lamb chris at chris-lamb.co.uk
Tue Aug 2 04:38:12 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 91f5f78473df45ef0794cb4a351518bab3ccc4cb
Author: Chris Lamb <lamby at debian.org>
Date:   Mon Aug 1 22:37:51 2016 -0400

    bin/trydiffoscope: Optionally poll locally until result is available.
---
 bin/trydiffoscope | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/bin/trydiffoscope b/bin/trydiffoscope
index 8d813b9..aa931d1 100755
--- a/bin/trydiffoscope
+++ b/bin/trydiffoscope
@@ -20,6 +20,7 @@
 
 import os
 import sys
+import time
 import argparse
 import requests
 import webbrowser
@@ -38,6 +39,14 @@ class TryDiffoscope(object):
 
         url = response.json()['url']
 
+        while self.args.poll:
+            time.sleep(1)
+            response = requests.head(url)
+            response.raise_for_status()
+
+            if response.status_code == 302:
+                break
+
         print(url)
 
         if self.args.webbrowser:
@@ -68,6 +77,13 @@ if __name__ == '__main__':
         action='store_true',
     )
 
+    parser.add_argument(
+        '-p',
+        '--poll',
+        help="Poll for result instead of using.",
+        action='store_true',
+    )
+
     args = parser.parse_args()
 
     for x in args.file:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list