upload_metrics.py 604 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/env python
  2. # Copyright (c) 2018 The Chromium Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. import sys
  6. from third_party.six.moves import urllib
  7. from third_party.six.moves import input # pylint: disable=redefined-builtin
  8. import metrics_utils
  9. def main():
  10. metrics = input()
  11. try:
  12. urllib.request.urlopen(
  13. metrics_utils.APP_URL + '/upload', metrics.encode('utf-8'))
  14. except (urllib.error.HTTPError, urllib.error.URLError):
  15. pass
  16. return 0
  17. if __name__ == '__main__':
  18. sys.exit(main())