Skip to content
Merged
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
16 changes: 10 additions & 6 deletions apm.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@

if ver==2: # Python 2

def cmd(server, app, aline):
def cmd(server, app, aline, disp=True):
'''Send a request to the server \n \
server = address of server \n \
app = application name \n \
aline = line to send to server \n'''
aline = line to send to server \n \
disp = Print output \n'''
try:
# Web-server URL address
url_base = string.strip(server) + '/online/apm_line.php'
Expand All @@ -40,7 +41,8 @@ def cmd(server, app, aline):
if not char:
break
elif char == '\n':
print(line)
if disp:
print(line)
line = ''
else:
line += char
Expand Down Expand Up @@ -308,11 +310,12 @@ def load_meas(server,app,name,value):

else: # Python 3+

def cmd(server,app,aline):
def cmd(server,app,aline, disp=True):
'''Send a request to the server \n \
server = address of server \n \
app = application name \n \
aline = line to send to server \n'''
aline = line to send to server \n \
disp = Print output \n'''
try:
# Web-server URL address
url_base = server.strip() + '/online/apm_line.php'
Expand All @@ -330,7 +333,8 @@ def cmd(server,app,aline):
if not char:
break
elif char == '\n':
print(line)
if disp:
print(line)
line = ''
else:
line += char
Expand Down