OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2016 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2016 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Utility for generating experimental API tokens | 6 """Utility for generating experimental API tokens |
7 | 7 |
8 usage: generate_token.py [-h] [--key-file KEY_FILE] | 8 usage: generate_token.py [-h] [--key-file KEY_FILE] |
9 [--expire-days EXPIRE_DAYS | | 9 [--expire-days EXPIRE_DAYS | |
10 --expire-timestamp EXPIRE_TIMESTAMP] | 10 --expire-timestamp EXPIRE_TIMESTAMP] |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 sys.exit(1) | 173 sys.exit(1) |
174 | 174 |
175 | 175 |
176 # Output the token details | 176 # Output the token details |
177 print "Token details:" | 177 print "Token details:" |
178 print " Origin: %s" % args.origin | 178 print " Origin: %s" % args.origin |
179 print " Is Subdomain: %s" % args.is_subdomain | 179 print " Is Subdomain: %s" % args.is_subdomain |
180 print " Feature: %s" % args.trial_name | 180 print " Feature: %s" % args.trial_name |
181 print " Expiry: %d (%s UTC)" % (expiry, datetime.utcfromtimestamp(expiry)) | 181 print " Expiry: %d (%s UTC)" % (expiry, datetime.utcfromtimestamp(expiry)) |
182 print " Signature: %s" % ", ".join('0x%02x' % ord(x) for x in signature) | 182 print " Signature: %s" % ", ".join('0x%02x' % ord(x) for x in signature) |
| 183 print " Signature (Base64): %s" % base64.b64encode(signature) |
183 print | 184 print |
184 | 185 |
185 # Output the properly-formatted token. | 186 # Output the properly-formatted token. |
186 print FormatToken(VERSION, signature, token_data) | 187 print FormatToken(VERSION, signature, token_data) |
187 | 188 |
188 if __name__ == "__main__": | 189 if __name__ == "__main__": |
189 main() | 190 main() |
OLD | NEW |