Skip to content

Commit

Permalink
Add option to force a specific speedtest server.
Browse files Browse the repository at this point in the history
  • Loading branch information
mishaturnbull committed Jan 19, 2018
1 parent 14635fb commit 72b731a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
*.pyc
*.ilog
report*
*exe*
build/
dist/
Records/
.spyproject/
6 changes: 5 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import time
import sys

from settings import REC_FILE, LOCATION, FREQ, VERBOSITY
from settings import REC_FILE, LOCATION, FREQ, VERBOSITY, FORCE_SERVER

try:
import pyspeedtest
Expand All @@ -30,6 +30,10 @@ def dprint(level, msg):
while True:

st = pyspeedtest.SpeedTest()

# Yes, I know this is ultra-bad practice. I'm overriding the setting
# without editing the source of pyspeedtest.
st._host = FORCE_SERVER # pylint: disable=W0212

a = datetime.datetime.now()
curtime = a.strftime("%a %b %d %w %Y at %H:%M:%S")
Expand Down
12 changes: 10 additions & 2 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
######## Name of file to output to:
# No matter the extension, the program writes pure text data and the file can
# be opened and read with any text editor
REC_FILE = "speed_record.ilog"
REC_FILE = "speed_record_room.ilog"

######## Location to record at:
# The program supports recording speeds at multiple locations (e.g. 'Outside
# room 301' or 'Atrium'). Set the location here. For prettier outputs,
# don't set a location longer than the guide below.
# Guide: "-----------------"
LOCATION = "Common Area"
LOCATION = "McVey 306B"

######## Speed test frequency:
# This value specifies how many minutes should elapse between speed tests.
Expand All @@ -35,6 +35,14 @@
# Well I mean decimals *should* work but why would you want do that?
VERBOSITY = 3

######## Speedtest server:
# If (and only if) you would like to specify a specific speedtest server,
# set the next value to the string format of the url of the server.
# For example, "speedtest.midco.net".
# If you would like to have the program (pyspeedtest) determine the best server
# automatically, leave the value as None.
FORCE_SERVER = None

################ ANALYTICS PROGRAM SETTINGS ################

######## Name of file to analyze:
Expand Down

0 comments on commit 72b731a

Please sign in to comment.