When I parsed the Pipfile given in the example section, an attribute error came up because the line
requests = { extras = ['socks'] },
coz there is a list but it doesn't contain a dictionary. So just checking the type solved the issue.
def inject_environment_variables(d):
if not d:
return d
for k, v in d.items():
if isinstance(v, str):
d[k] = os.path.expandvars(v)
elif isinstance(v, dict):
d[k] = inject_environment_variables(v)
elif isinstance(v, list):
for e in v:
if type(e) == 'dict':
d[k] = inject_environment_variables(e)
else:
continue
return d
When I parsed the Pipfile given in the example section, an attribute error came up because the line
requests = { extras = ['socks'] },
coz there is a list but it doesn't contain a dictionary. So just checking the type solved the issue.