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)}
|
||||
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()
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue