diff options
author | Martin Hořeňovský <martin.horenovsky@gmail.com> | 2020-03-19 12:32:34 +0100 |
---|---|---|
committer | Martin Hořeňovský <martin.horenovsky@gmail.com> | 2020-03-19 12:32:34 +0100 |
commit | 020b6556356cfd1fe0d62579123e9802f787eb07 (patch) | |
tree | 68e3cd7faa407b0085073ea2eed5ae469b2db1af | |
parent | 5561d0342dfbfb6882361aeb519bbdfb49fa6eb8 (diff) | |
download | catch2-020b6556356cfd1fe0d62579123e9802f787eb07.tar.gz |
Update wandbox script to use https endpoint and Python3
-rw-r--r-- | scripts/updateWandbox.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/scripts/updateWandbox.py b/scripts/updateWandbox.py index b448713d..fa25ef1b 100644 --- a/scripts/updateWandbox.py +++ b/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 |