Skip to content

Commit

Permalink
option name for headless to console
Browse files Browse the repository at this point in the history
  • Loading branch information
pkpio committed Jun 1, 2017
1 parent b231918 commit bfa32fa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,11 @@ Add above line to your cron tab: ```crontab -e``` in Linux. Sync logs will be st

# Headless authentication
----------------------------
If you want to do the authentication process on a system without a display - such as a raspberry pi or a remote server, pass `--headless` or `-c` option to the authentication scripts. See below examples.
If you want to do the authentication process on a system without a display - such as a raspberry pi or a remote server, pass `--console` or `-c` option to the authentication scripts. See below examples.

`python3 auth_fitbit.py -i clientid -s clientsecret --headless`
`python3 auth_google.py -i clientid -s clientsecret --headless`
`python3 auth_fitbit.py -i clientid -s clientsecret --console`

`python3 auth_google.py -i clientid -s clientsecret --console`

Note :
-------
Expand Down
4 changes: 2 additions & 2 deletions auth/auth_fitbit.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ def main():
parser.add_argument("-i", "--id", required=True, help="Client id", metavar='<client-id>')
parser.add_argument("-s", "--secret", required=True, help="Client secret",
metavar='<client-secret>')
parser.add_argument("-c", "--headless", default=False,
parser.add_argument("-c", "--console", default=False,
help="Authenticate only using console (for headless systems)", action="store_true")
args = parser.parse_args()

server = OAuth2Server(args.id, args.secret)
if args.headless:
if args.console:
server.headless_authorize()
else:
server.browser_authorize()
Expand Down
4 changes: 2 additions & 2 deletions auth/auth_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def main():
parser.add_argument("-i", "--id", required=True, help="Client id", metavar='<client-id>')
parser.add_argument("-s", "--secret", required=True, help="Client secret",
metavar='<client-secret>')
parser.add_argument("-c", "--headless", default=False,
parser.add_argument("-c", "--console", default=False,
help="Authenticate only using console (for headless systems)", action="store_true")
args = parser.parse_args()

Expand All @@ -24,7 +24,7 @@ def main():

flow = OAuth2WebServerFlow(args.id, args.secret, scopes)
storage = Storage('google.json')
flags = ['--noauth_local_webserver'] if args.headless else []
flags = ['--noauth_local_webserver'] if args.console else []
run_flow(flow, storage, argparser.parse_args(flags))

if __name__ == '__main__':
Expand Down

0 comments on commit bfa32fa

Please sign in to comment.