Skip to content

async file upload #84

@MrWillTurner

Description

@MrWillTurner

Hi. I am trying to use the module asyncio to asynchronously upload files to my pcloud folder but it always blocks waits for the upload to be terminate before doing the next line

Do you have any idea of what I'm doing wrong ?

from dotenv import load_dotenv
import os
import asyncio


async def call_this(connection,file):
    await uploadfile(connection,file)

async def uploadfile(connection,file):
    await connection.uploadfile(files = file)
    print("done")

load_dotenv()

pcloud_user = os.environ.get("PCLOUD_USER")
pcloud_password = os.environ.get("PCLOUD_PASSWORD")

connection = PyCloud(pcloud_user, pcloud_password)



asyncio.run(call_this(connection,["test.png","test2.png"]))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions