Tongasoa eto amin'ny rakitra EPUB.to API
Raha te hahazo fanalahidin'ny mpamorona azafady mandehana anyvavahadin'ny mpamorona
Authorization: <api_key>
Niova fo avy amin'ny EPUB
EPUB mankany PDF
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.epub', 'testfiles/blah.epub', 'testfiles/blah.epub']
params = {
'lang': 'en',
'convert_to': 'epub-pdf'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.pdf
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
EPUB mankany MOBI
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.epub', 'testfiles/blah.epub', 'testfiles/blah.epub']
params = {
'lang': 'en',
'convert_to': 'epub-mobi'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.mobi
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
EPUB mankany AZW3
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.epub', 'testfiles/blah.epub', 'testfiles/blah.epub']
params = {
'lang': 'en',
'convert_to': 'epub-azw3'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.azw3
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
EPUB mankany amin'ny FB2
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.epub', 'testfiles/blah.epub', 'testfiles/blah.epub']
params = {
'lang': 'en',
'convert_to': 'epub-fb2'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.fb2
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
EPUB ka hatramin'ny CBZ
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.epub', 'testfiles/blah.epub', 'testfiles/blah.epub']
params = {
'lang': 'en',
'convert_to': 'epub-cbz'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.cbz
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
EPUB mankany CBR
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.epub', 'testfiles/blah.epub', 'testfiles/blah.epub']
params = {
'lang': 'en',
'convert_to': 'epub-cbr'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.cbr
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
EPUB mankany DOCX
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.epub', 'testfiles/blah.epub', 'testfiles/blah.epub']
params = {
'lang': 'en',
'convert_to': 'epub-docx'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.docx
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
EPUB mankany DOC
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.epub', 'testfiles/blah.epub', 'testfiles/blah.epub']
params = {
'lang': 'en',
'convert_to': 'epub-doc'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.doc
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
EPUB mankany HTML
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.epub', 'testfiles/blah.epub', 'testfiles/blah.epub']
params = {
'lang': 'en',
'convert_to': 'epub-html'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.html
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
EPUB mankany amin'ny RTF
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.epub', 'testfiles/blah.epub', 'testfiles/blah.epub']
params = {
'lang': 'en',
'convert_to': 'epub-rtf'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.rtf
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
EPUB mankany PNG
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.epub', 'testfiles/blah.epub', 'testfiles/blah.epub']
params = {
'lang': 'en',
'convert_to': 'epub-png'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.png
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
EPUB mankany SVG
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.epub', 'testfiles/blah.epub', 'testfiles/blah.epub']
params = {
'lang': 'en',
'convert_to': 'epub-svg'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.svg
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
EPUB mankany JPG
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.epub', 'testfiles/blah.epub', 'testfiles/blah.epub']
params = {
'lang': 'en',
'convert_to': 'epub-jpg'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.jpg
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
EPUB mankany BMP
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.epub', 'testfiles/blah.epub', 'testfiles/blah.epub']
params = {
'lang': 'en',
'convert_to': 'epub-bmp'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.bmp
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
EPUB mankany amin'ny ZIP
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.epub', 'testfiles/blah.epub', 'testfiles/blah.epub']
params = {
'lang': 'en',
'convert_to': 'epub-zip'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.zip
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
EPUB ka hatramin'ny GIF
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.epub', 'testfiles/blah.epub', 'testfiles/blah.epub']
params = {
'lang': 'en',
'convert_to': 'epub-gif'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.gif
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
EPUB mankany TIFF
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.epub', 'testfiles/blah.epub', 'testfiles/blah.epub']
params = {
'lang': 'en',
'convert_to': 'epub-tiff'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.tiff
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
Miova ho EPUB
PDF mankany EPUB
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.pdf', 'testfiles/blah.pdf', 'testfiles/blah.pdf']
params = {
'lang': 'en',
'convert_to': 'pdf-epub'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.epub
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
DOCX ka hatramin'ny EPUB
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.docx', 'testfiles/blah.docx', 'testfiles/blah.docx']
params = {
'lang': 'en',
'convert_to': 'docx-epub'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.epub
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao
DOC mankany EPUB
import requests
import time
import shutil
import json
headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.doc', 'testfiles/blah.doc', 'testfiles/blah.doc']
params = {
'lang': 'en',
'convert_to': 'doc-epub'
}
api_url = 'https://api.epub.to/v1/convert/'
results_url = 'https://api.epub.to/v1/results/'
def download_file(url, local_filename):
with requests.get("https://api.epub.to/%s" % url, stream=True) as r:
with open(local_filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
return local_filename
def convert_files(api_url, params, headers):
files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
print(files)
r = requests.post(
url=api_url,
files=files,
data=params,
headers=headers
)
return r.json()
def get_results(params):
if params.get('error'):
return params.get('error')
r = requests.post(
url=results_url,
data=params
)
data = r.json()
finished = data.get('finished')
while not finished:
if int(data.get('queue_count')) > 0:
print('queue: %s' % data.get('queue_count'))
time.sleep(5)
results = get_results(params)
print(results)
results = json.dumps(results)
if results:
break
if finished:
print(data.get('files'))
for f in data.get('files'):
print(f.get('url'))
download_file("%s" % f.get('url'), "%s" % f.get('filename'))
return {"finished": "files downloaded"}
return r.json()
get_results(convert_files(api_url, params, headers))
Hiverina
/path/to/local/file_processed.epub
Raha te hanao maromaro dia asio rakitra bebe kokoa ao anaty lisitrao