fix parser error

This commit is contained in:
Michaël Ricart 2018-03-12 00:02:05 +01:00
parent 1d16899296
commit f80a2d799e
2 changed files with 17 additions and 8 deletions

View file

@ -26,18 +26,27 @@ while True:
data = {option:config[section][option] for option in config_obj.options(section)}
del data['url']
del data['method']
print(data)
try:
if method == "GET":
print('GET')
r = requests.get(url, data=data)
if data :
r = requests.get(url, data=data)
else:
r = requests.get(url)
elif method == "POST":
print('POST')
r = requests.post(url, data=data)
if data:
r = requests.post(url, data=data)
else:
r = requests.post(url)
except:
pass
else:
print("close")
r.close()
print("closed")
print(url)
requests.get(url)
print("UNKNOWN ERROR")
continue
print("close")
r.close()
print("closed")
pin_value = current_value
collect()

View file

@ -63,7 +63,7 @@ class ConfigParser:
end_index = None
else:
end_index = block.index(end_flag[0])
values = [value.split('=')[-1].strip() for value in block[start_index:end_index] if value]
values = [value.split('=',1)[-1].strip() for value in block[start_index:end_index] if value]
if not values:
values = None
elif len(values) == 1: