(cls, app, file, type=None, permenant=False, save=True)
return media_id
上传素材
        :param type: image|voice|video|thumb
        :returns: media_id,如果保存返回Material实例
上传素材
        :param type: image|voice|video|thumb
        :returns: media_id,如果保存返回Material实例
上传素材 : param type : image|voice|video|thumb : returns : media_id 如果保存返回Material实例
def upload(cls, app, file, type=None, permenant=False, save=True):
        """
        上传素材
        :param type: image|voice|video|thumb
        :returns: media_id,如果保存返回Material实例
        """
        if isinstance(file, requests.Response):
            fileinfo = cls.get_response_file_info(file, type)
            filename = fileinfo.get("filename")
            file = (filename, file.content)
            if not type:
                type = fileinfo.get("type")

        assert type is not None

        if type == Material.Type.NEWS:
            permenant = True
            data = app.client.material.add_articles(file)
        elif permenant:
            data = app.client.material.add(type, file)
        else:
            data = app.client.media.upload(type, file)
        media_id = data["media_id"]

        if permenant and save:
            if type in (Material.Type.NEWS, Material.Type.VIDEO):
                return app.sync_materials(media_id, type=type)
            else:
                return app.materials.create_material(
                    type=type, media_id=media_id, url=data.get("url"))
        return media_id
def upload ( cls , app , file , type = None , permenant = False , save = True ) : if isinstance ( file , requests . Response ) : fileinfo = cls . get_response_file_info ( file , type ) filename = fileinfo . get ( "filename" ) file = ( filename , file . content ) if not type : type = fileinfo . get ( "type" ) assert type is not None if type == Material . Type . NEWS : permenant = True data = app . client . material . add_articles ( file ) elif permenant : data = app . client . material . add ( type , file ) else : data = app . client . media . upload ( type , file ) media_id = data [ "media_id" ] if permenant and save : if type in ( Material . Type . NEWS , Material . Type . VIDEO ) : return app . sync_materials ( media_id , type = type ) else : return app . materials . create_material ( type = type , media_id = media_id , url = data . get ( "url" ) ) return media_id