So i got a refresh token in this way and can I keep it?
And if so, how do I use it next time, so that there is no need for me to open browser?
Right now I'm thinking about creating OAuth2Credentials object directly, is this the right way?
from urllib.parse import urlparse, parse_qsfrom oauth2client.client import flow_from_clientsecrets, OAuth2Credentialsfrom oauth2client.file import Storagefrom oauth2client.tools import argparser, run_flowfrom apiclient.discovery import buildfrom apiclient.errors import HttpErrorfrom oauth2client.contrib import gceimport httplib2import webbrowserCLIENT_SECRETS_FILE = "bot_credentials.json"flow = client.flow_from_clientsecrets( CLIENT_SECRETS_FILE, scope=scope,redirect_uri='http://127.0.0.1:65010')flow.params['include_granted_scopes'] = 'true'flow.params['access_type'] = 'offline'auth_uri = flow.step1_get_authorize_url()webbrowser.open(auth_uri)url = input('Please enter the redirected url with code')code = get_url_param(url, 'code')if code is None: print('there is an error in your redirect link with code parameter, check if it exists') exit()print(code)credentials = flow.step2_exchange(code[0])print(credentials.to_json())#refresh_token here!!!