a5a4457b5aa0e2c081662adc4177af95338fccd4 — Ellie Mae Galyean 4 months ago 47d5249
Seems to work with python3 now
2 files changed, 10 insertions(+), 10 deletions(-)

M app.py
M lib.py
M app.py => app.py +2 -2
@@ 12,7 12,7 @@ @app.route('/permanize', methods=['POST', 'OPTIONS'])
  def my_service():
  	request.get_json(force=True)
- 	print request.json
+ 	print(request.json)
  	text = request.json['text']
  	if 'apikey' in request.json and len(request.json['apikey'])>0:
  		return jsonify(text=replaceText(text,request.json['apikey']))


@@ 20,4 20,4 @@ return jsonify(text=replaceText(text,False))
  
  if __name__ == "__main__":
-     app.run(host='0.0.0.0',port=8012)> 
\ No newline at end of file
+     app.run(host='0.0.0.0',port=8012)

M lib.py => lib.py +8 -8
@@ 20,7 20,7 @@ return url,url
    try:
      r = requests.get('https://web.archive.org/save/' + url)
-     print "Got permanent link for " + url
+     print("Got permanent link for " + url)
    except:
      return url,url
    if r.status_code == 403:


@@ 29,7 29,7 @@ try:
        return url,'https://web.archive.org' + r.headers['content-location']
      except:
-       print url
+       print(url)
        return url,url
      
  def getPermaccLink(dat):


@@ 39,10 39,10 @@ payload = {'url': url, 'title': url}
    permacc_url =  'https://api.perma.cc/v1/archives/?api_key=' + apikey
    r = requests.post(permacc_url, data = json.dumps(payload))
-   print r.status_code
+   print(r.status_code)
    if r.status_code == 201:
      result = json.loads(r.text)
-     print json.dumps(result,indent=4)
+     print(json.dumps(result,indent=4))
      return url,str('http://perma.cc/' + result['guid'] + '?type=source')
    else:
      return url,url


@@ 71,13 71,13 @@ conversion[result[0]] = result[1]    
    p.terminate()
  
-   print conversion
+   print(conversion)
    curPos = 0
    for url in urls_in_order:
      if url in text_test[curPos:]:
-       print url
-       print conversion[url]
-       print text_test[curPos:]
+       print(url)
+       print(conversion[url])
+       print(text_test[curPos:])
        newPos = text_test.index(url)
        text_test = text_test[0:curPos] + text_test[curPos:].replace(url,conversion[url],1)
        curPos = newPos