Exemple #1
0
username = raw_input("Please enter your Assembla.com username: "******"and password: "******"Please enter the name of the space to copy tickets from: ")
space2 = raw_input("Please enter the name of the space to copy tickets to: ")

tickets = raw_input("Please enter full path to ticket list: ")

api = API(client_id, client_secret)

refresh_token = config.get('ClientTokens', 'refresh_token')
bearer_token = config.get('ClientTokens', 'bearer_token')
if bearer_token != "None":
    try:
        api.initTokens(bearer_token, refresh_token)
        api.me()
    except AssemblaError:
        api = init_client(api)
        bearer_token = api.client.access_token
        refresh_token = api.client.refresh_token
else:
    api = init_client(api)
    bearer_token = api.client.service.access_token

with open(filename, 'wb') as configfile:
    config.set('ApplicationTokens', 'client_id', client_id)
    config.set('ApplicationTokens', 'client_secret', client_secret)
    config.set('ClientTokens', 'bearer_token', bearer_token)
    config.set('ClientTokens', 'refresh_token', refresh_token)
    config.write(configfile)