Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: remoting/tools/register_host.py

Issue 3252006: Updated chromoting directory URL to use www.googleapis.com, switched to https.. (Closed)
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/tools/hostdir.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 # 6 #
7 # register_host.py registers new hosts in chromoting directory. It 7 # register_host.py registers new hosts in chromoting directory. It
8 # asks for username/password and then writes these settings to config file. 8 # asks for username/password and then writes these settings to config file.
9 9
10 import getpass 10 import getpass
11 import os 11 import os
12 import urllib 12 import urllib
13 import urllib2 13 import urllib2
14 import random 14 import random
15 import socket 15 import socket
16 import sys 16 import sys
17 17
18 import gaia_auth 18 import gaia_auth
19 import keygen 19 import keygen
20 20
21 def random_uuid(): 21 def random_uuid():
22 return ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x" % 22 return ("%04x%04x-%04x-%04x-%04x-%04x%04x%04x" %
23 tuple(map(lambda x: random.randrange(0,65536), range(8)))) 23 tuple(map(lambda x: random.randrange(0,65536), range(8))))
24 24
25 server = 'www-googleapis-test.sandbox.google.com' 25 server = 'www.googleapis.com'
26 url = 'http://' + server + '/chromoting/v1/@me/hosts' 26 url = 'https://' + server + '/chromoting/v1/@me/hosts'
27 27
28 settings_filepath = os.path.join(os.path.expanduser('~'), 28 settings_filepath = os.path.join(os.path.expanduser('~'),
29 '.ChromotingConfig.json') 29 '.ChromotingConfig.json')
30 30
31 print "Email:", 31 print "Email:",
32 email = raw_input() 32 email = raw_input()
33 password = getpass.getpass("Password: ") 33 password = getpass.getpass("Password: ")
34 34
35 chromoting_auth = gaia_auth.GaiaAuthenticator('chromoting') 35 chromoting_auth = gaia_auth.GaiaAuthenticator('chromoting')
36 auth_token = chromoting_auth.authenticate(email, password) 36 auth_token = chromoting_auth.authenticate(email, password)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 settings_file.write('{\n'); 79 settings_file.write('{\n');
80 settings_file.write(' "xmpp_login" : "' + email + '",\n') 80 settings_file.write(' "xmpp_login" : "' + email + '",\n')
81 settings_file.write(' "xmpp_auth_token" : "' + auth_token + '",\n') 81 settings_file.write(' "xmpp_auth_token" : "' + auth_token + '",\n')
82 settings_file.write(' "host_id" : "' + host_id + '",\n') 82 settings_file.write(' "host_id" : "' + host_id + '",\n')
83 settings_file.write(' "host_name" : "' + host_name + '",\n') 83 settings_file.write(' "host_name" : "' + host_name + '",\n')
84 settings_file.write(' "private_key" : "' + private_key + '",\n') 84 settings_file.write(' "private_key" : "' + private_key + '",\n')
85 settings_file.write('}\n') 85 settings_file.write('}\n')
86 settings_file.close() 86 settings_file.close()
87 87
88 print 'Configuration saved in', settings_filepath 88 print 'Configuration saved in', settings_filepath
OLDNEW
« no previous file with comments | « remoting/tools/hostdir.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698