()
return util.response_success()
Save a compiled bot to object storage.
Save a compiled bot to object storage.
Save a compiled bot to object storage .
def upload_bot():
    """Save a compiled bot to object storage."""
    user_id = flask.request.form.get("user_id", None)
    bot_id = flask.request.form.get("bot_id", None)

    if "bot.zip" not in flask.request.files:
        raise util.APIError(400, message="Please provide the bot file.")

    uploaded_file = flask.request.files["bot.zip"]
    # Save to GCloud
    blob = gcloud_storage.Blob("{}_{}".format(user_id, bot_id),
                               model.get_bot_bucket(),
                               chunk_size=262144)
    blob.upload_from_file(uploaded_file)
    return util.response_success()
def upload_bot ( ) : user_id = flask . request . form . get ( "user_id" , None ) bot_id = flask . request . form . get ( "bot_id" , None ) if "bot.zip" not in flask . request . files : raise util . APIError ( 400 , message = "Please provide the bot file." ) uploaded_file = flask . request . files [ "bot.zip" ] # Save to GCloud blob = gcloud_storage . Blob ( "{}_{}" . format ( user_id , bot_id ) , model . get_bot_bucket ( ) , chunk_size = 262144 ) blob . upload_from_file ( uploaded_file ) return util . response_success ( )