summaryrefslogtreecommitdiff
path: root/install-files/essential-files/usr/bin/brpaste
diff options
context:
space:
mode:
authorJavier Jardón <jjardon@gnome.org>2015-09-04 18:21:27 +0100
committerJavier Jardón <jjardon@gnome.org>2015-09-22 02:53:00 +0100
commit50b12ebbedec8dbf823905d60712784b9a5cdb8f (patch)
tree9e4eaaa4ccd24aae365126effc167a009fc0d2cd /install-files/essential-files/usr/bin/brpaste
parentd36e5611404f5b0c97d5b4d1b3f49431de9581dc (diff)
downloaddefinitions-50b12ebbedec8dbf823905d60712784b9a5cdb8f.tar.gz
core: Use python3 instead python2jjardon/python3_default
From [1]: "Python 2.x is legacy, Python 3.x is the present and future of the language" As a reference, python3 is already the default python version in Arch, and other distros like Ubuntu/Debian [2] or Fedora [3] are planning to switch soon [1] https://wiki.python.org/moin/Python2orPython3 [2] https://wiki.ubuntu.com/Python/3 [3] https://fedoraproject.org/wiki/Changes/Python_3_as_Default Change-Id: I6d4d11844d4424bfa49b37fe7d9a3639547c0139
Diffstat (limited to 'install-files/essential-files/usr/bin/brpaste')
-rw-r--r--install-files/essential-files/usr/bin/brpaste12
1 files changed, 6 insertions, 6 deletions
diff --git a/install-files/essential-files/usr/bin/brpaste b/install-files/essential-files/usr/bin/brpaste
index 15f976b9..d2f9d867 100644
--- a/install-files/essential-files/usr/bin/brpaste
+++ b/install-files/essential-files/usr/bin/brpaste
@@ -1,6 +1,6 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
-import urllib2
+import urllib.request
import os
import json
@@ -15,14 +15,14 @@ def run(*args):
extensions = [None]
for i, each in enumerate(content):
- req = urllib2.Request(URL, each)
- response = urllib2.urlopen(req)
- the_page = response.read()
+ req = urllib.request.Request(URL, each.encode('utf-8'))
+ response = urllib.request.urlopen(req)
+ the_page = response.read().decode('utf-8')
key = json.loads(the_page)['key']
url = "http://paste.baserock.org/%s" % key
if extensions[i]:
url += extensions[i]
- print url
+ print(url)
if __name__ == '__main__':
import sys