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
Changes from 1 commit
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
Prev Previous commit
Fix no global variable. 🕊
  • Loading branch information
mpotane authored Oct 12, 2022
commit d6cdeb852a68fcac35d848994d90935f27fc4451
37 changes: 22 additions & 15 deletions Speed Test/speedtest.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import speedtest
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!")


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()