import os
import json

from apiclient import discovery
import oauth2client
from oauth2client import client
from oauth2client import tools

try:
    import argparse
    flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args()
except ImportError:
    flags = None

SCOPES = 'https://www.googleapis.com/auth/gmail.send'

with open('config.json') as config_file:
    config = json.load(config_file)

def main():
    store = oauth2client.file.Storage(config['credentials_file'])
    credentials = store.get()
    if not credentials or credentials.invalid:
        flow = client.flow_from_clientsecrets(config['client_secret_file'], SCOPES)
        flow.user_agent = 'contact-me'
        if flags:
            credentials = tools.run_flow(flow, store, flags)
        else: # Needed only for compatability with Python 2.6
            credentials = tools.run(flow, store)
        print 'Storing credentials to ' + credential_path

if __name__ == '__main__':
    main()

@@ -914,16 +914,24 @@
  to ' + 
+config%5B'
 credenti
@@ -936,13 +936,16 @@
 tial
-_path
+s_file'%5D
 %0A%0Aif

fix authorize.py error