Example:
###env
base_url = 'http://localhost:8080'
session_id = 'myid'
def apicall(path):
return "{}{};jsessid={}".format(base_url, path, session_id)
###env
# Profile
get(apicall("/api/foo"))
The call fails because base_url and session_id are empty in the defined function. Declaring them nonlocal doesn't help. How can this be accomplished without duplicating the constants?