fix parser error
This commit is contained in:
parent
1d16899296
commit
f80a2d799e
2 changed files with 17 additions and 8 deletions
|
@ -26,18 +26,27 @@ while True:
|
||||||
data = {option:config[section][option] for option in config_obj.options(section)}
|
data = {option:config[section][option] for option in config_obj.options(section)}
|
||||||
del data['url']
|
del data['url']
|
||||||
del data['method']
|
del data['method']
|
||||||
|
print(data)
|
||||||
try:
|
try:
|
||||||
if method == "GET":
|
if method == "GET":
|
||||||
print('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":
|
elif method == "POST":
|
||||||
print('POST')
|
print('POST')
|
||||||
r = requests.post(url, data=data)
|
if data:
|
||||||
|
r = requests.post(url, data=data)
|
||||||
|
else:
|
||||||
|
r = requests.post(url)
|
||||||
except:
|
except:
|
||||||
pass
|
print(url)
|
||||||
else:
|
requests.get(url)
|
||||||
print("close")
|
print("UNKNOWN ERROR")
|
||||||
r.close()
|
continue
|
||||||
print("closed")
|
print("close")
|
||||||
|
r.close()
|
||||||
|
print("closed")
|
||||||
pin_value = current_value
|
pin_value = current_value
|
||||||
collect()
|
collect()
|
||||||
|
|
|
@ -63,7 +63,7 @@ class ConfigParser:
|
||||||
end_index = None
|
end_index = None
|
||||||
else:
|
else:
|
||||||
end_index = block.index(end_flag[0])
|
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:
|
if not values:
|
||||||
values = None
|
values = None
|
||||||
elif len(values) == 1:
|
elif len(values) == 1:
|
||||||
|
|
Loading…
Reference in a new issue