Nov-14-2018, 10:23 PM
What about passing the other functions a file object it can read/write to, instead of having it open it's own files? Something like
with requests.Session() as rest_session: with open("log.txt", "a") as log: data = rest_session.get_data() unrelated = read(log) write(data, log) if unrelated == "OK": rest_session.POST("spam")