diff options
author | dbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-04 23:52:57 +0000 |
---|---|---|
committer | dbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-04 23:52:57 +0000 |
commit | 71f10089bb06ef69112f05fe042047da68a52255 (patch) | |
tree | a89fa2ac61d3772f19d8b43289e03e3485418fdd /third_party | |
parent | 022ac65b2c7ecb48a81076c769f7ad29e4f9152c (diff) | |
download | chromium_src-71f10089bb06ef69112f05fe042047da68a52255.zip chromium_src-71f10089bb06ef69112f05fe042047da68a52255.tar.gz chromium_src-71f10089bb06ef69112f05fe042047da68a52255.tar.bz2 |
rAc: add script to scrape "require" key from i18n responses for countries.
R=estade@chromium.org
BUG=331455
TEST=easier to update "require" fields
NOTRY=true
Review URL: https://codereview.chromium.org/132803007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248811 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rwxr-xr-x | third_party/libaddressinput/chromium/tools/require_fields.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/third_party/libaddressinput/chromium/tools/require_fields.py b/third_party/libaddressinput/chromium/tools/require_fields.py new file mode 100755 index 0000000..b82afa247 --- /dev/null +++ b/third_party/libaddressinput/chromium/tools/require_fields.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import json +import urllib +from sys import exit as sys_exit + + +# Derived from region_data_constants.cc. +_COUNTRIES = [ + 'AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'AN', 'AO', 'AQ', 'AR', 'AS', + 'AT', 'AU', 'AW', 'AX', 'AZ', 'BA', 'BB', 'BD', 'BE', 'BF', 'BG', 'BH', + 'BI', 'BJ', 'BL', 'BM', 'BN', 'BO', 'BR', 'BS', 'BT', 'BV', 'BW', 'BY', + 'BZ', 'CA', 'CC', 'CD', 'CF', 'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', + 'CO', 'CR', 'CS', 'CV', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO', + 'DZ', 'EC', 'EE', 'EG', 'EH', 'ER', 'ES', 'ET', 'FI', 'FJ', 'FK', 'FM', + 'FO', 'FR', 'GA', 'GB', 'GD', 'GE', 'GF', 'GG', 'GH', 'GI', 'GL', 'GM', + 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GW', 'GY', 'HK', 'HM', 'HN', + 'HR', 'HT', 'HU', 'ID', 'IE', 'IL', 'IM', 'IN', 'IO', 'IQ', 'IS', 'IT', + 'JE', 'JM', 'JO', 'JP', 'KE', 'KG', 'KH', 'KI', 'KM', 'KN', 'KR', 'KW', + 'KY', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', 'LS', 'LT', 'LU', 'LV', + 'LY', 'MA', 'MC', 'MD', 'ME', 'MF', 'MG', 'MH', 'MK', 'ML', 'MN', 'MO', + 'MP', 'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA', + 'NC', 'NE', 'NF', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', 'OM', + 'PA', 'PE', 'PF', 'PG', 'PH', 'PK', 'PL', 'PM', 'PN', 'PR', 'PS', 'PT', + 'PW', 'PY', 'QA', 'RE', 'RO', 'RS', 'RU', 'RW', 'SA', 'SB', 'SC', 'SE', + 'SG', 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM', 'SN', 'SO', 'SR', 'ST', 'SV', + 'SZ', 'TC', 'TD', 'TF', 'TG', 'TH', 'TJ', 'TK', 'TL', 'TM', 'TN', 'TO', + 'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'UM', 'US', 'UY', 'UZ', 'VA', + 'VC', 'VE', 'VG', 'VI', 'VN', 'VU', 'WF', 'WS', 'YE', 'YT', 'ZA', 'ZM', 'ZW' +] +_I18N_URL = 'https://i18napis.appspot.com/address/data/%s' + + +def main(): + for country in _COUNTRIES: + url = _I18N_URL % country + try: + data = json.load(urllib.urlopen(url)) + except Exception as e: + print 'Error: could not load %s' % url + return 1 + if 'require' in data: + print '%s: %s' % (country, data['require']) + return 0 + + +if __name__ == '__main__': + sys_exit(main()) |