1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
Description: Use Python 3 instead of Python 2
Author: Olek Wojnar <olek@debian.org>
Forwarded: not-needed
Last-Update: 2020-06-18
--- a/buildscripts/set_github_status.py
+++ b/buildscripts/set_github_status.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.7
+#!/usr/bin/env python3
#
# Copyright 2018 The gRPC Authors
#
@@ -16,7 +16,7 @@
import argparse
import json
-import urllib2
+import urllib.request, urllib.error, urllib.parse
def run():
@@ -46,7 +46,7 @@
with open(oauth_file, 'r') as oauth_file_reader:
oauth_token = oauth_file_reader.read().replace('\n', '')
- req = urllib2.Request(
+ req = urllib.request.Request(
url='https://api.github.com/repos/grpc/grpc-java/statuses/%s' % sha1,
data=json.dumps({
'state': state,
@@ -57,7 +57,7 @@
'Authorization': 'token %s' % oauth_token,
'Content-Type': 'application/json',
})
- print urllib2.urlopen(req).read()
+ print(urllib.request.urlopen(req).read())
if __name__ == '__main__':
|