def convert_image(pic_url):

    print("convertImage")
    api = cloudconvert.Api(
        'f8dd1C2EAcY2y1TfRcbig-HZo-kGNKHUjR_9d3IhXYi7EnPyP1WxTYChAC7He7mMzTZEJG-ctFboNNlQuHxpyg'
    )
    #Other API key :D
    #7pjLey9FiQhFMSvCIMHNuuALHXKIiYlSNrKY3-TcOWlHDGXBQusDvdv9zP3lKOuNv01GSN78GI_DK25XjdBW8w
    #WYSr7kqythqGEd937K0i1JLWcM-3yJKBn2VUEAPovhGV7SfK4g3MK_rXO2ru3ILqf09v23j9KTkPri32Ar-jdA

    ############################Depleted Keys
    #I5FzHhAXRON-HOBeINgZaWIQBE3D2DnG_jRdZuKP_J2InvfLyu4SY_00m9qtc_VPj-IjWACvdZ3phRP6hmXljA
    #f8dd1C2EAcY2y1TfRcbig-HZo-kGNKHUjR_9d3IhXYi7EnPyP1WxTYChAC7He7mMzTZEJG-ctFboNNlQuHxpyg

    process = api.convert({
        "input": "download",
        "save": "true",
        "filename": "in.gif",
        "inputformat": "gif",
        "outputformat": "png",
        "file": pic_url
    })
    # process.wait()

    while (process['step'] == "convert"):
        print(process['percent'])

    returned = "http:" + process['output']['url']
    return returned
def api_get_routine(path):
    try:
        files = os.listdir(path)
    except:
        print "path: " + path + " is invalid :("
        return

    api = cloudconvert.Api(API_KEY)

    for name in files:
        if ".numbers" in name:
            print(
                "\n--------------------------------------------------\nprocessing: "
                + name)
            process = api.convert({
                "inputformat": "numbers",
                "outputformat": "pdf",
                "input": "upload",
                "file": open(os.path.join(path, name), 'rb')
            })
            print "    + " + process['message']
            process.wait()
            print "    + " + process['message']
            try:
                process.download(path)
            except:
                print "downloading failed >:("
            print "    + converted " + name + "-->" + name[0:-8] + ".pdf"
    print(
        "\n==================================================\n    complete!")
def speechToText():
    import cloudconvert
    api = cloudconvert.Api(
        'dNjRGRXdyfWenzq21X1zRYbM3aFXGMF30udg3zTqxe7vYy0i9eO0rdx5fAdCjUNH')

    process = api.convert({
        "inputformat": "oga",
        "outputformat": "wav",
        "input": "upload",
        "file": open('received.oga', 'rb')
    })
    process.wait()
    process.download()

    import speech_recognition as sr
    from pydub import AudioSegment
    r = sr.Recognizer()
    # x=AudioSegment.from_file("received.oga", format='oga')
    # x.export("received.wav", format="wav")
    with sr.AudioFile(('received.wav')) as source:
        audio = r.record(source)
        #print(audio)
    try:
        text = r.recognize_google(
            audio)  # use recognizer to convert our audio into text part.
        print("You said : {}".format(text))
        return text
    except:
        print("Sorry could not recognize your voice")
        return ""
Beispiel #4
0
    def get(self, request, user, slug):
        creation = get_object_or_404(Creation, slug=slug, author__username=user)

        cache_key = 'png_url;{};{};{}'.format(
            creation.author,
            creation.slug,
            format(creation.last_modified, 'U'),
        )

        output_url = cache.get(cache_key)
        if output_url is None:
            svg_path = reverse(
                'creations:svg-preview',
                kwargs={'user': creation.author, 'slug': creation.slug},
            )
            api = cloudconvert.Api(settings.CLOUDCONVERT_KEY)

            input_url = '{}?facebook'.format(request.build_absolute_uri(svg_path))
            process = api.convert({
                "inputformat": "svg",
                "outputformat": "png",
                "input": "download",
                "file": input_url,
                "converteroptions": {
                    "resize": "1200x630"
                },
                "save": True,
            })
            output_url = process['output']['url']
            cache.set(cache_key, output_url, 60 * 60 * 23.5)  # keep for 23.5 hours

        return HttpResponseRedirect(output_url)
Beispiel #5
0
def ico_2_any(name_list):

    # Private API key - (https://cloudconvert.com/)
    api = cloudconvert.Api('PUT_YOUR_API_KEY')

    print("ICO TO GIF Converting...")
    cnt = 1

    for i in name_list:

        # If you want different format, Change 'outputformat' : 'PNG, GIF .. etc'
        process = api.convert({
            'inputformat': 'ico',
            'outputformat': 'gif',
            'input': 'upload',
            'file': open("icon/" + i + ".ico", 'rb')
        })
        process.wait()
        process.download("icon/" + i +
                         ".gif")  # download output file(Check your format)

        if cnt != len(name_list):
            print(str(cnt) + "/" + str(len(name_list)) + " progressed... ")
        else:
            print(str(cnt) + "/" + str(len(name_list)) + " finished!")

        cnt += 1

    print("Convert Finished!")
def process_convert(inputformat, outputformat, inputfile, save_filename):
    """
    创建一个process转换格式并把文件下载下来
    :param inputfile: 上传文件路径
    :param save_filename: 保存的文件名(含文件路径)
    :param inputformat: 上传的文件格式
    :param outputformat: 目标格式
    """
    API_KEY = random.choice([
        'DbCqLbhEnDyhIqFv1rvqEyrunYSirQQSjpCTiLJ5IjUwPdj3Wba5nT0SJ77jN3oO',
        'J1WZq6CVKnp3XmDNmCoJVxYLoRBtD02xlQW9nx27HzVoAvcflbsXY3mjyXgKTTCF',
    ])

    api = cloudconvert.Api(api_key=API_KEY)

    process = api.convert({
        'inputformat': inputformat,
        'outputformat': outputformat,
        'input': 'upload',
        'file': open(inputfile, 'rb')
    })

    process.wait()

    process.download('%s' % save_filename)
Beispiel #7
0
def doc_get_page_num(file_name, file_ext):
    if file_ext == '.pdf':
        from PyPDF2 import PdfFileReader
        pdf = PdfFileReader(open(file_name, 'rb'))
        return (pdf.getNumPages(), file_name)
    elif file_ext in ['.doc', '.docx']:
        import subprocess
        file_prefix = file_name[:-len(file_ext)]
        pdf_filename = file_prefix + '.pdf'
        # try:
        #     subprocess.check_call(['unoconv', '-f', 'pdf', '-o', pdf_filename, '-d', 'document', file_name])
        # except subprocess.CalledProcessError as e:
        #     print('CalledProcessError', e)

        import cloudconvert
        import buu_config

        config = buu_config.config()

        api = cloudconvert.Api(config.convert_api)

        process = api.convert({
            'inputformat': file_ext[1:],
            'outputformat': 'pdf',
            'input': 'upload',
            'file': open(file_name, 'rb')
        })
        process.wait()  # wait until conversion finished
        process.download(pdf_filename)  # download output file

        from PyPDF2 import PdfFileReader
        pdf = PdfFileReader(open(pdf_filename, 'rb'))
        return (pdf.getNumPages(), pdf_filename)
Beispiel #8
0
def download_thumbnail(youtube_thumbnail_url):
    # Get the API key from the API_KEY file
    with open("API_KEY", "r") as file:
        API_KEY = file.read()

    # All of cloudconvert's processes and conversions
    print("Creating process...")
    api = cloudconvert.Api(API_KEY)
    process = api.createProcess({
        "inputformat": "jpg",
        "outputformat": "jpg"
    })

    print("Converting image...")

    process.start({
        "input": "download",
        "file": youtube_thumbnail_url,
        "outputformat": "jpg",
        "preset": "AduhH6JcFl",
        "wait": True
    })

    process.refresh()

    process.wait()
    print(process["message"])

    print("Downloading image to the same directory as the YT2TVDB.py file...")
    process.download()
    print("Download finished!")
def auto_md2rst(input_file, output_file):
    try:
        my_key = 'NrtpV6kD5BdVxJ2R20eBqgCHK6heTjEMxtWSWENeZ9HdKUj5Ew3aCpodMCPPwLeH'

        import cloudconvert
        api = cloudconvert.Api(my_key)
        process = api.createProcess({
            "inputformat": "md",
            "outputformat": "rst"
        })

        process.start({
            "input": "upload",
            "file": open(input_file, 'rb'),
            "filename": ""
        })

        process.refresh()  # fetch status from API
        process.wait()  # wait until conversion completed
        print(process['message'])  #  access process data

        process.download(output_file)

        print("OK")
    except Exception as e:
        print(e)
Beispiel #10
0
 def __init__(self,
              key=CLOUD_KEY,
              input_format="pdf",
              output_format="epub"):
     self.converter = cloudconvert.Api(CLOUD_KEY)
     self.process = self.converter.createProcess({
         "inputformat": "pdf",
         "outputformat": "epub"
     })
Beispiel #11
0
def downloadFileandConvert(audioFileLocation):
    urllib.request.urlretrieve(audioFileLocation,'audioclip.aac')
    try:
        api = cloudconvert.Api('5wYY-t4lBPaS82pOFHCGuNvNeXEUBfrEkcLKTN7Pz3IFRc_T7IQ7_VHHsBVbv07AJihdRKP3tv96fFhc5il8Sw')
        process = api.convert({"inputformat": "aac","outputformat": "wav","input": "upload","converteroptions": { "audio_frequency": "16000"},"file": open('audioclip.aac', 'rb')})
        process.wait()
        process.download()
    except:
        return "Not Ok"
Beispiel #12
0
def main(fic,frmt):
    api = cloudconvert.Api('j1FXpcE7GZrISh9BjzaSF6Y3lylcvsJb9opigTFEr0DdKScCADf4l2QvJlQckk0P')
    process = api.convert({
        'inputformat': fic[fic.index('.')+1:],
        'outputformat': frmt,
        'input': 'upload',
        'file': open(fic, 'rb')
    })

    process.wait()
    process.download(fic[:fic.index('.')]+'_Convert'+'.'+frmt)
    
    return      
Beispiel #13
0
def url(text):
    #生成音频
    DetectorFactory.seed = 0 #让结果唯一
    tts_en = gTTS(text,lang=detect(text))
    ok = tts_en.save('hello.mp3')

    #转换音频
    api = cloudconvert.Api('%s' % apis[random_api])
    process = api.convert({
        'inputformat': 'mp3',
        'outputformat': 'm4a',
        'input': 'upload',
        'file': open('hello.mp3', 'rb')
    })
    process.wait()
    m4a_data = process.download("hello.m4a")

    #获取秘钥
    token_para = {
        "key1":"0hVSV9FP7xepWnTR4rJrklZ6aw4R272xTwR5V1BoTrjuJNrRMIv20NVHkCzVA23z",
        "key2":"4KN3PnTnohpg3eXeLO67duuIJvbf6nloqCeBODrtvSlMwkHA8Iost6YiyFyThX4B"
    }
    token = requests.get(token_url,params=token_para)
    token_data = json.loads(token.text)
    access_token = token_data["data"]["access_token"]

    #上传文件并获取文件ID
    data = {
        "account_id"   : "29913",
        "access_token" : "%s" % access_token
    }
    with open('hello.m4a','rb') as filedata:
        data_url = requests.post(up_load_url, files={'upload_file': filedata},data=data)
        dict_data = json.loads(data_url.text)
        print(dict_data)
        file_id = dict_data["data"][0]["file_id"]
        print('file_id:%s' % file_id)

    #获取下载链接
    download_para = {
        "account_id"   : "29913",
        "access_token" : "%s" % access_token,
        "file_id"   : "%s" % file_id
        }

    r = requests.get(download_url,params=download_para)
    download_data = json.loads(r.text)
    print(download_data)
    ok = download_data["data"]["download_url"]
    print('download_url:%s' % ok )
    return ok
Beispiel #14
0
def convert(filename):
    print("CONVERTING .........")
    api = cloudconvert.Api(
        '8tyeHHS7LiRGE5ngypb8JVBWjRDY6375KxuBBm2VxekRTVeQzRfEs9iyapP4rbDA')
    process = api.convert({
        'inputformat': 'txt',
        'outputformat': 'pdf',
        'input': 'upload',
        'file': open(filename, 'rb')
    })
    process.wait()  # wait until conversion finished
    pdf_file_name = filename[:len(filename)-4]+".pdf"
    process.download(pdf_file_name)
    return pdf_file_name
def convert_DOCX2PDF(path, api_key):
    api = cloudconvert.Api(api_key)
    process = api.createProcess({
        "inputformat": "docx",
        "outputformat": "pdf"
    })
    process = api.convert({
        'inputformat': 'docx',
        'outputformat': 'pdf',
        'input': 'upload',
        'file': open(path + '-anonymous_2.docx', 'rb')
    })
    process.wait() # wait until conversion finished
    process.download(path + "-anonymised.pdf") # download output file
Beispiel #16
0
def downloadImages():
    # Calling api to convert images
    api = cloudconvert.Api(
        'tpdYmzoswVXlDQoU0qz54F7sCs9HOBu06lkDV3BJz8oyUhGBpgbDQD3Fw0goOhKH')
    process = api.convert({
        "inputformat": "pdf",
        "outputformat": "png",
        "input": "upload",
        "file": open('poems.pdf', 'rb')
    })
    process.wait()
    # Downloading images to raw_images folder
    process.download("raw_images/")
    print("Images downloaded")
Beispiel #17
0
 def transfer(self,file):
     api = cloudconvert.Api("5jahP1MXvASNf6nqMdctxIxbxKa9Dl4FrMwVruGQYCbhtAtUdE5WrSOX1MwNenju")
     process = api.createProcess({
         "inputformat": "pdf",
         "outputformat": "txt"
     })
     process = api.convert({
         "inputformat": "pdf",
         "outputformat": "txt",
         "input": "upload",
         "file": open(file, 'rb')
     })
     process.wait()
     process.download()
Beispiel #18
0
def cloud_convert(page_range, path):
    api = cloudconvert.Api(
        'jJihZWVlAY2YoYnSmSOvHIADAt8BXI0G6jwb1DLKzJKIVIodL7qqWrMXoQ8SVDBy')
    process = api.convert({
        'inputformat': 'pdf',
        'outputformat': 'jpg',
        'converteroptions': {
            'page_range': page_range  #'7-10'
        },
        'input': 'upload',
        'file': open(path, 'rb')
    })
    process.wait()
    process.download("/home/san/aaa")
Beispiel #19
0
def generate_proof_pdf(proof_id):
    proof = Proof.objects.get(pk=proof_id)
    try:
        if not proof.docx:
            return

        print("Converting proof id=%s, file=%s to PDF." %
              (proof.id, proof.docx.name))

        if not settings.CLOUDCONVERT_API_KEY:
            raise Exception(
                "Configuration error: CLOUDCONVERT_API_KEY must be set to convert files"
            )
        api = cloudconvert.Api(settings.CLOUDCONVERT_API_KEY)

        # convert proof.docx to a named BufferedReader by writing to temp dir -- required for cloudconvert
        with tempfile.TemporaryDirectory() as tmp_dir:
            tmp_path = os.path.join(tmp_dir, proof.docx.name)
            open(tmp_path, 'wb').write(proof.docx.file.read())
            docx = BufferedReader(open(tmp_path, 'rb'))

            process = api.convert({
                "inputformat": "docx",
                "outputformat": "pdf",
                "input": "upload",
                "converteroptions": {
                    "pdf_a": True,
                },
                "file": docx
            })
            process.wait()

        temp_file = tempfile.NamedTemporaryFile()
        process.download(temp_file.name)
        proof.pdf.save(proof.docx.name.replace('.docx', '.pdf'),
                       File(temp_file))
        proof.pdf_status = "generated"
        proof.save()

        print("Converted! %s status = %s" % (proof.id, proof.pdf_status))

        for case in proof.cases.all():
            case.update_last_page_number(proof)

    except Exception as e:
        proof.pdf_status = "failed"
        proof.save()
        raise
Beispiel #20
0
def main(input_file):

	inputformat = "pdf"
	outputformat = "txt"

	api = cloudconvert.Api('X0LnpbqjPzPCKTWJAh50nMORz0olrqfJHHJ9gYFaQRfBuwv7QaEmmUPpwftXiAuY')

	process = api.convert({
	    'inputformat': inputformat,
	    'outputformat': outputformat,
	    'input': 'upload',
	    'file': open('{}'.format(input_file), 'rb')
	})
	process.wait() # wait until conversion finished
	print("downloading converted file....")
	process.download("python_app/converted.{}".format(outputformat)) # download output file
Beispiel #21
0
def convert_to_txt(filenames):
    final_files = []
    for i in filenames:
        api = cloudconvert.Api(
            '2R83XvhTuELfut2PvQbv0rRgPRSlTGA2wICqnQRUdnJL7YVua17xrHHpufJzqQtC')
        process = api.convert({
            'inputformat': 'docx',
            'outputformat': 'txt',
            'input': 'upload',
            'file': open(i, 'rb')
        })
        process.wait()  # wait until conversion finished
        txt_file_name = i[:len(i) - 5] + ".txt"
        process.download(txt_file_name)
        final_files.append(txt_file_name)
    return final_files
def convert_PDF2DOCX(path, api_key):
    api = cloudconvert.Api(api_key)
    process = api.createProcess({
        "inputformat": "pdf",
        "outputformat": "docx"
    })
    process = api.convert({
        'inputformat': 'pdf',
        'outputformat': 'docx',
        'input': 'upload',
        'file': open(path+'.pdf', 'rb')
    })
    # wait until conversion finished
    process.wait() 
    # download output file
    process.download(path+".docx") 
Beispiel #23
0
def convert():
    print 'convert func'
    api = cloudconvert.Api('***REMOVED***')

    file_name = os.path.join(os.path.dirname(__file__), 'my_audio.mp4')

    process = api.convert({
        "inputformat": "mp4",
        "outputformat": "wav",
        "input": "upload",
        "file": file_name
    })
    process.wait()
    process.download('my_audio.wav')

    print 'download ke baad'
    return "converted to wav"
Beispiel #24
0
def convert_file(file, process_id, upload_to):
    file_handler = open(file, 'rb')
    api = cloudconvert.Api(API_key[random.randint(0, 2)])
    split_arr = os.path.splitext(file_handler.name)
    realname = split_arr[0].split('/')[-1]
    postfix = split_arr[1][1:]
    process = api.convert({
        'inputformat': postfix,
        'outputformat': 'jpg',
        'input': 'upload',
        'filename': '%s.%s' % (realname, postfix),
        'file': file_handler
    })
    processes[process_id] = process
    process.wait()
    process.download(upload_to)
    return '%s/%s.zip' % (upload_to, realname)
Beispiel #25
0
def convertFile(user, file):
    fileDir = './' + str(user.user_file)
    oldFormat = fileFormat(file)
    api = cloudconvert.Api(
        '7AoDsm4GZV8LpmYqZHESw4GKqDo1DcZ3ooQtqWR1fhaKZ-Jiva2gC94GVrYRuEEdfkqWVNBHZFGCIYSZAAh3cA'
    )
    process = api.convert({
        "inputformat": oldFormat,
        "outputformat": "png",
        "input": "upload",
        "filename": "user." + oldFormat,
        "file": open(fileDir, 'rb')
    })
    process.wait()
    process.download('./frontend/static/pptzip/' + str(user.id) + 'and' +
                     str(user.file_num) + '.zip')
    os.remove(fileDir)
    return
def convert_file(input_file_path,
                 output_file_path,
                 input_format="docx",
                 output_format="pdf",
                 cloudconvert_mode="convert"):

    # retry 100 times
    for i in range(0, 100):
        try:
            # create cloudconvert api object
            api_key = cloudconvert_api_key.get_api_key()
            api = cloudconvert.Api(api_key)

            # create cloudconvert process object
            process = api.convert({
                "inputformat": input_format,
                "outputformat": output_format,
                "input": "upload",
                "mode": cloudconvert_mode,
                "file": open(input_file_path, 'rb')
            })

            # wait for process to complete
            process.wait()

            # download converted file
            process.download(output_file_path)

            # delete process
            process.delete()

            return output_file_path

        # retry on CloudConvert exceptions
        except cloudconvert.exceptions.HTTPError:
            continue
        except cloudconvert.exceptions.ConversionFailed:
            continue

    # if we fail too many times, just quit
    else:
        raise Exception(
            "Could not communication with CloudConvert after 100 tries")
    return
Beispiel #27
0
 def handle(self):
     secret = self.dependencies.get_secret("CLOUDCONVERT_API_KEY")
     api = cloudconvert.Api(secret)
     for record in self.event['Records']:
         key: str = record['s3']['object']['key']
         # remove percent encoding that's apparently
         # applied somewhere in the lambda pipeline
         key = urllib.parse.unquote(key)
         key = urllib.parse.unquote_plus(key)
         log.info(f'handling {key}')
         _, ext = os.path.splitext(key)
         ext = ext.replace('.', '')
         organization_id, *rest = os.path.split(key)
         original_name = os.path.join(*rest)
         organization = self.dependencies.database.get_organization(
             organization_id)
         document = self.dependencies.annotation_database(
             organization).create_document(
                 Document(original_name, converted=False))
         collection_key = f'{organization_id}/{document.ref.id()}.html'
         log.info(f'converting and saving to {collection_key}')
         convert_config = {
             'inputformat': ext,
             'outputformat': 'html',
             'input': {
                 's3': {
                     "accesskeyid": os.environ['AWS_ACCESS_KEY_ID'],
                     "secretaccesskey": os.environ['AWS_SECRET_ACCESS_KEY'],
                     "sessiontoken": os.environ['AWS_SESSION_TOKEN'],
                     "bucket": self.dependencies.upload_bucket.name
                 }
             },
             'file': key,
             "output": {
                 "s3": {
                     "accesskeyid": os.environ['AWS_ACCESS_KEY_ID'],
                     "secretaccesskey": os.environ['AWS_SECRET_ACCESS_KEY'],
                     "sessiontoken": os.environ['AWS_SESSION_TOKEN'],
                     "bucket": self.dependencies.collection_bucket.name,
                     "path": collection_key
                 }
             }
         }
         api.convert(convert_config)
Beispiel #28
0
def upload_document(request):
    m = BASE_DIR + "\\media\\"
    t = BASE_DIR + "\\templates\\"
    context = {}
    if request.method == "POST":
        usr = User.objects.get(username=request.user)
        in_user = InmergenceUser.objects.get(user=usr)
        org = Organization.objects.get(user=usr)
        fformat = request.POST['fileFormat']
        file = request.FILES['file']
        id = uuid.uuid4()
        doc, created = Document.objects.get_or_create(
            id=id,
            organization=org,
            name=file.name,
            file=file,
            html_name=file.name[:-3] + 'html',
            user=in_user)
        doc.save()
        api = cloudconvert.Api(
            'HKi3ooM6JI_caLFxb90B5lYONnKmoGjGNZ8R3Ozx22XB9pJJDzk1wx9fBgJEDqu-s_gmwWc1R31h_YPABQOZjw'
        )
        process = api.convert({
            "input": "upload",
            "email": "false",
            "inputformat": fformat,
            "outputformat": "html",
            "preset": "ytfLaX3GgM",
            "file": open(m + str(doc.file), 'rb')
        })

        path = t + org.name.replace(' ', '_') + '\\'
        if not os.path.exists(path):
            os.mkdir(path)
        process.wait()
        process.download(path)
        real_file_name_to_zip = str(doc.file).replace(
            str(org.name).replace(" ", "_") + "/", "").replace('.pdf', '.zip')
        clean_html(t, str(org.name).replace(' ', '_'), real_file_name_to_zip)
        context = {}

    return render(request, 'index.html', context)
Beispiel #29
0
def to_text(m4a_data):
    #转换音频为wav
    api = cloudconvert.Api('%s' % apis[random_api])
    process = api.convert({
        'inputformat': 'm4a',
        'outputformat': 'wav',
        'input': 'upload',
        'file': open(m4a_data, 'rb')
    })
    process.wait()
    wav_data = process.download("hello.wav")

    #分析wav音频
    r = sr.Recognizer()
    harvard = sr.AudioFile('hello.wav')
    with harvard as source:
        # 去噪
        r.adjust_for_ambient_noise(source, duration=0.2)
        audio = r.record(source)

    # 语音识别,返回是识别结果
    test = r.recognize_google(audio, language="cmn-Hans-CN", show_all=True)
    print(test['alternative'][0]['transcript'])
    return test['alternative'][0]['transcript']
Beispiel #30
0
    Raise error, if environment variable can't be found, else return it's value
    """
    value = os.environ.get(name)
    if value is None:
        raise AttributeError("Environment variable %s is not set" % name)
    return value


CC_KEY = required_env("CLOUDCONVERT_KEY")

LIST_ID = int(required_env("MAILING_LIST_ID"))
MAILING_URI = "https://broadcast.vkforms.ru/api/v2/broadcast?token=" + required_env(
    "MAILING_KEY")

app = Bottle()
cc = cloudconvert.Api(CC_KEY)


def vk_send(image_urls):
    data = dict(message=dict(images=image_urls), list_ids=[LIST_ID], run_now=1)
    requests.post(MAILING_URI, json=data)


def docx_to_image(doc):
    doc = io.BufferedReader(doc)
    process = cc.createProcess(dict(inputformat="docx", outputformat="png"))
    process.start(
        dict(outputformat="png",
             input="upload",
             file=doc,
             filename="timetable.docx",