summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-10-02 13:44:17 +0200
committerAndreas Schneider <asn@cryptomilk.org>2013-10-02 13:44:17 +0200
commit7939df347f00e5e4faf4e6c2e75ff6885727f4c1 (patch)
treecc2f3fa3357cb95a4d58992df5c8f503f34e1436
parent59e36cff8f646d6314e884e227d22bc09d52cc7f (diff)
downloadcpaste-7939df347f00e5e4faf4e6c2e75ff6885727f4c1.tar.gz
cpaste-7939df347f00e5e4faf4e6c2e75ff6885727f4c1.tar.xz
cpaste-7939df347f00e5e4faf4e6c2e75ff6885727f4c1.zip
Put the paste url into a variable and use https.
-rwxr-xr-xcpaste12
1 files changed, 8 insertions, 4 deletions
diff --git a/cpaste b/cpaste
index 636917b..8a57a41 100755
--- a/cpaste
+++ b/cpaste
@@ -30,6 +30,10 @@ import json
import requests
from optparse import OptionParser
+
+paste_url = 'https://cpaste.org'
+
+
parser = OptionParser()
parser.add_option("-f", "--file", dest="filename",
help="Read from a file instead of stdin", metavar="FILE")
@@ -62,7 +66,7 @@ payload = {'data':''.join(paste_data), 'language': options.lang, 'private': opti
# http content type
headers = {'Content-Type': 'application/json'}
-r = requests.post('http://cpaste.org/api/json/create', data=json.dumps(payload), headers=headers)
+r = requests.post(paste_url + '/api/json/create', data=json.dumps(payload), headers=headers)
result = json.loads(r.text)['result']
@@ -72,8 +76,8 @@ if result.get(u'error', None):
hash = result.get(u'hash', None)
if hash and len(hash) > 0:
- print "https://cpaste.org/%(id)s/%(hash)s" % result
+ print paste_url + "/%(id)s/%(hash)s" % result
else:
- print "https://cpaste.org/%(id)s" % result
+ print paste_url + "/%(id)s" % result
-# http://cpaste.org/api/json/create
+sys.exit(0)