This commit is contained in:
Allen Short 2013-01-02 15:53:19 -08:00
Родитель eb1339a674
Коммит b06487facd
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -4,9 +4,11 @@ This script is for setting up OAuth credentials for Google Analytics.
To use: To use:
Visit https://code.google.com/apis/console/ and select "API Access". Visit https://code.google.com/apis/console/ and select "API Access".
If a client ID for a "web application" hasn't been created, add one. If a client ID for an "installed application" hasn't been created, add one.
Click "Download JSON" in the box containing information about that client ID. Click "Download JSON" in the box containing information about that client ID.
Run this script with the filename of the downloaded JSON. Run this script: 'python auth_google_analytics.py --secrets client_secrets.json'
(If you are running this on a host with no web browser, pass
--noauth_local_webserver as well.)
Paste the printed credentials into the Django settings file. Paste the printed credentials into the Django settings file.
""" """
@ -17,13 +19,11 @@ import gflags
from oauth2client.client import flow_from_clientsecrets, Storage from oauth2client.client import flow_from_clientsecrets, Storage
from oauth2client.tools import run from oauth2client.tools import run
if len(sys.argv) < 2: gflags.DEFINE_string('secrets', None, 'Client secret JSON filename', short_name='f')
print "usage: auth_google_analytics.py <client secrets filename> [--noauth_local_webserver]"
sys.exit(1)
gflags.FLAGS(sys.argv) gflags.FLAGS(sys.argv)
CLIENT_SECRETS = sys.argv[1] CLIENT_SECRETS = gflags.FLAGS.secrets
MISSING_CLIENT_SECRETS_MESSAGE = ("%s is missing or doesn't contain secrets " MISSING_CLIENT_SECRETS_MESSAGE = ("%s is missing or doesn't contain secrets "
"for a web application" % CLIENT_SECRETS) "for a web application" % CLIENT_SECRETS)