Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Update wandbox script to use https endpoint and Python3

Commit
d3c0b36487b5a6b5e83f302d80fda2c6fb3c623d
Author
Martin Hořeňovský ·
Parents
95a2e547027c

Files · Download .tar.gz

Changes

 tools/scripts/updateWandbox.py | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/tools/scripts/updateWandbox.py b/tools/scripts/updateWandbox.py
index b448713d..fa25ef1b 100644
--- a/tools/scripts/updateWandbox.py
+++ b/tools/scripts/updateWandbox.py
@@ -1,16 +1,18 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 import json
 import os
-import urllib2
+import urllib.request
 
 from scriptCommon import catchPath
 
 def upload(options):
-    request = urllib2.Request('http://melpon.org/wandbox/api/compile.json')
-    request.add_header('Content-Type', 'application/json')
-    response = urllib2.urlopen(request, json.dumps(options))
-    return json.loads(response.read())
+    request = urllib.request.Request('https://melpon.org/wandbox/api/compile.json', method='POST')
+    json_bytes = json.dumps(options).encode('utf-8')
+    request.add_header('Content-Type', 'application/json; charset=utf-8')
+    request.add_header('Content-Length', len(json_bytes))
+    response = urllib.request.urlopen(request, json_bytes)
+    return json.loads(response.read().decode('utf-8'))
 
 main_file = '''
 #define CATCH_CONFIG_MAIN  // This tells Catch to provide a main() - only do this in one cpp file