Skip to content

Create speedtest.py #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Speed Test/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
speedtest
23 changes: 23 additions & 0 deletions Speed Test/speedtest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import speedtest


def main():
try:
st = speedtest.Speedtest()
server_names = []
st.get_servers(server_names)
downlink_bps = st.download()
uplink_bps = st.upload()
ping = st.results.ping
up_mbps = round(uplink_bps/1000000,2)
down_mbps = round(downlink_bps/1000000,2)
print('speed test results:')
print('ping: {} ms'.format(ping))
print('upling: {} Mbps'.format(up_mbps))
print('downling: {} Mbps'.format(down_mbps))
except:
print("Speed test can't perform right now!")


if __name__ == '__main__':
main()