Spaces:
Runtime error
Runtime error
Create speedtest.py
Browse files- speedtest.py +14 -0
speedtest.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import requests
|
| 3 |
+
|
| 4 |
+
data = b"x" * 10_000_000 # 10 MB
|
| 5 |
+
|
| 6 |
+
start = time.time()
|
| 7 |
+
response = requests.post("https://httpbin.org/post", data=data)
|
| 8 |
+
end = time.time()
|
| 9 |
+
|
| 10 |
+
duration = end - start
|
| 11 |
+
speed_mbps = (len(data) * 8) / (duration * 1_000_000)
|
| 12 |
+
|
| 13 |
+
print(f"Upload time: {duration:.2f} seconds")
|
| 14 |
+
print(f"Estimated outbound upload speed: {speed_mbps:.2f} Mbps")
|