OAuth avoid user interaction?

Hello, I’m new to Asana and OAuth, but know Python quite well. I’m looking at:

It all makes sense, and works, but this part is very painful for user interaction and needs to be avoided for end-users to accept the tool I’m building. Am I missing some basic ‘requests.??’ functionality to return the code without forcing user interaction?

(url, state) = client.session.authorization_url()
import webbrowser
webbrowser.open(url)

# Chrome opens, and user must copy and paste a string!!

code = sys.stdin.readline().strip()
# code = my.gui.linereader()
# exchange the code for a bearer token
token = client.session.fetch_token(code=code)

OK so the Refresh token is the way to go, based on this: Get refresh token

Does anyone have any experience setting that up in Python via the ‘asana’ module? I’m basing this on examples provided but it’s not obvious to me the Refresh part of the process.