Skip to content

Instantly share code, notes, and snippets.

@sallyruthstruik
Created December 29, 2016 12:50
Show Gist options
  • Save sallyruthstruik/ef186ae48a6f79ec465b5d2699523990 to your computer and use it in GitHub Desktop.
Save sallyruthstruik/ef186ae48a6f79ec465b5d2699523990 to your computer and use it in GitHub Desktop.
from __future__ import division
import webdav.client as wc
import time
options = {
'webdav_hostname': "https://webdav.yandex.ru",
'webdav_login': "s.kaledin@coin32.com",
'webdav_password': "*******"
}
client = wc.Client(options)
with open("file.txt", "w") as fd:
fd.write("1"*1024*1024) #1 mb
times = []
for i in range(1000):
start = time.time()
client.upload(
local_path="file.txt",
remote_path="file.txt"
)
d = time.time() - start
times.append(d)
print "Block", i, "in", d, "seconds"
print "Average speed per all blocks", (i+1)/sum(times), "Mb/s", "per block", 1/d, "Mb/s"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment