fixes for python3
This commit is contained in:
parent
79fa8402a5
commit
81517ae18d
14
utils.py
14
utils.py
|
@ -2,13 +2,13 @@ from settings import username, password, url
|
|||
import ox
|
||||
import json
|
||||
import codecs
|
||||
import urllib2
|
||||
from urllib.request import urlopen
|
||||
|
||||
api = ox.api.API(url)
|
||||
user = api.signin({'username': username, 'password': password})
|
||||
|
||||
if user['data'].has_key("errors"):
|
||||
print "Authentication Failed!"
|
||||
if 'errors' in user['data']:
|
||||
print("Authentication Failed!")
|
||||
|
||||
def titleContains(string):
|
||||
return api.find({
|
||||
|
@ -117,7 +117,7 @@ def replacePlaceNames(old, new, operator="", start=0, end=100):
|
|||
if new_value == '':
|
||||
log = "EMPTY VALUE: %s" % m['id']
|
||||
logFile.write(log)
|
||||
print log
|
||||
print(log)
|
||||
continue
|
||||
ret.append(api.editAnnotation({
|
||||
'id': m['id'],
|
||||
|
@ -127,7 +127,7 @@ def replacePlaceNames(old, new, operator="", start=0, end=100):
|
|||
}))
|
||||
log = "%s| %s| %s" % (m['id'], value, new_value,)
|
||||
logFile.write(log + "\n")
|
||||
print log
|
||||
print(log)
|
||||
logFile.close()
|
||||
return ret
|
||||
|
||||
|
@ -219,10 +219,10 @@ def getTranscriptsForList(listId='sanj:spaces of theatre'):
|
|||
items = [{'id': item['id'], 'title': item['title']} for item in result['data']['items']]
|
||||
outfolder = "out"
|
||||
for i in items:
|
||||
print i['title']
|
||||
print(i['title'])
|
||||
savePath = "%s/%s_%s.txt" % (outfolder, i['id'], i['title'])
|
||||
transcript_url = 'http://pad.ma/%s/transcripts.srt' % i['id']
|
||||
txt = urllib2.urlopen(transcript_url).read()
|
||||
txt = urlopen(transcript_url).read()
|
||||
outfile = open(savePath, "w")
|
||||
outfile.write(txt)
|
||||
outfile.close()
|
||||
|
|
Loading…
Reference in New Issue
Block a user