forked from AdamLaurie/RFIDIOt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiso3166.py
More file actions
executable file
·556 lines (555 loc) · 16 KB
/
Copy pathiso3166.py
File metadata and controls
executable file
·556 lines (555 loc) · 16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
# -*- coding: iso-8859-15 -*-
# ISO-3166 alpha country codes - ver 1
ISO3166CountryCodesAlpha= { "ABW":"Aruba",\
"AFG":"Afghanistan",\
"AGO":"Angola",\
"AIA":"Anguilla",\
"ALA":"Åland Islands",\
"ALB":"Albania",\
"AND":"Andorra",\
"ANT":"Netherlands Antilles",\
"ARE":"United Arab Emirates",\
"ARG":"Argentina",\
"ARM":"Armenia",\
"ASM":"American Samoa",\
"ATA":"Antarctica",\
"ATF":"French Southern Territories",\
"ATG":"Antigua and Barbuda",\
"AUS":"Australia",\
"AUT":"Austria",\
"AZE":"Azerbaijan",\
"BDI":"Burundi",\
"BDR":"Bundesdruckerei",\
"BEL":"Belgium",\
"BEN":"Benin",\
"BFA":"Burkina Faso",\
"BGD":"Bangladesh",\
"BGR":"Bulgaria",\
"BHR":"Bahrain",\
"BHS":"Bahamas",\
"BIH":"Bosnia and Herzegovina",\
"BLR":"Belarus",\
"BLZ":"Belize",\
"BMU":"Bermuda",\
"BOL":"Bolivia",\
"BRA":"Brazil",\
"BRB":"Barbados",\
"BRN":"Brunei Darussalam",\
"BTN":"Bhutan",\
"BVT":"Bouvet Island",\
"BWA":"Botswana",\
"CAF":"Central African Republic",\
"CAN":"Canada",\
"CCK":"Cocos (Keeling) Islands",\
"CHE":"Switzerland",\
"CHL":"Chile",\
"CHN":"China",\
"CIV":"Côte d'Ivoire",\
"CMR":"Cameroon",\
"COD":"Congo, the Democratic Republic of the",\
"COG":"Congo",\
"COK":"Cook Islands",\
"COL":"Colombia",\
"COM":"Comoros",\
"CPV":"Cape Verde",\
"CRI":"Costa Rica",\
"CUB":"Cuba",\
"CXR":"Christmas Island",\
"CYM":"Cayman Islands",\
"CYP":"Cyprus",\
"CZE":"Czech Republic",\
"DEU":"Germany",\
# for brain-damaged german passports
"D":"Germany",\
"DJI":"Djibouti",\
"DMA":"Dominica",\
"DNK":"Denmark",\
"DOM":"Dominican Republic",\
"DZA":"Algeria",\
"ECU":"Ecuador",\
"EGY":"Egypt",\
"ERI":"Eritrea",\
"ESH":"Western Sahara",\
"ESP":"Spain",\
"EST":"Estonia",\
"ETH":"Ethiopia",\
"FIN":"Finland",\
"FJI":"Fiji",\
"FLK":"Falkland Islands (Malvinas)",\
"FRA":"France",\
"FRO":"Faroe Islands",\
"FSM":"Micronesia, Federated States of",\
"GAB":"Gabon",\
"GBR":"United Kingdom",\
"GEO":"Georgia",\
"GGY":"Guernsey",\
"GHA":"Ghana",\
"GIB":"Gibraltar",\
"GIN":"Guinea",\
"GLP":"Guadeloupe",\
"GMB":"Gambia",\
"GNB":"Guinea-Bissau",\
"GNQ":"Equatorial Guinea",\
"GRC":"Greece",\
"GRD":"Grenada",\
"GRL":"Greenland",\
"GTM":"Guatemala",\
"GUF":"French Guiana",\
"GUM":"Guam",\
"GUY":"Guyana",\
"HKG":"Hong Kong",\
"HMD":"Heard Island and McDonald Islands",\
"HND":"Honduras",\
"HRV":"Croatia",\
"HTI":"Haiti",\
"HUN":"Hungary",\
"IDN":"Indonesia",\
"IMN":"Isle of Man",\
"IND":"India",\
"IOT":"British Indian Ocean Territory",\
"IRL":"Ireland",\
"IRN":"Iran, Islamic Republic of",\
"IRQ":"Iraq",\
"ISL":"Iceland",\
"ISR":"Israel",\
"ITA":"Italy",\
"JAM":"Jamaica",\
"JEY":"Jersey",\
"JOR":"Jordan",\
"JPN":"Japan",\
"KAZ":"Kazakhstan",\
"KEN":"Kenya",\
"KGZ":"Kyrgyzstan",\
"KHM":"Cambodia",\
"KIR":"Kiribati",\
"KNA":"Saint Kitts and Nevis",\
"KOR":"Korea, Republic of",\
"KWT":"Kuwait",\
"LAO":"Lao People's Democratic Republic",\
"LBN":"Lebanon",\
"LBR":"Liberia",\
"LBY":"Libyan Arab Jamahiriya",\
"LCA":"Saint Lucia",\
"LIE":"Liechtenstein",\
"LKA":"Sri Lanka",\
"LSO":"Lesotho",\
"LTU":"Lithuania",\
"LUX":"Luxembourg",\
"LVA":"Latvia",\
"MAC":"Macao",\
"MAR":"Morocco",\
"MCO":"Monaco",\
"MDA":"Moldova, Republic of",\
"MDG":"Madagascar",\
"MDV":"Maldives",\
"MEX":"Mexico",\
"MHL":"Marshall Islands",\
"MKD":"Macedonia, the former Yugoslav Republic of",\
"MLI":"Mali",\
"MLT":"Malta",\
"MMR":"Myanmar",\
"MNE":"Montenegro",\
"MNG":"Mongolia",\
"MNP":"Northern Mariana Islands",\
"MOZ":"Mozambique",\
"MRT":"Mauritania",\
"MSR":"Montserrat",\
"MTQ":"Martinique",\
"MUS":"Mauritius",\
"MWI":"Malawi",\
"MYS":"Malaysia",\
"MYT":"Mayotte",\
"NAM":"Namibia",\
"NCL":"New Caledonia",\
"NER":"Niger",\
"NFK":"Norfolk Island",\
"NGA":"Nigeria",\
"NIC":"Nicaragua",\
"NIU":"Niue",\
"NLD":"Netherlands",\
"NOR":"Norway",\
"NPL":"Nepal",\
"NRU":"Nauru",\
"NZL":"New Zealand",\
"OMN":"Oman",\
"PAK":"Pakistan",\
"PAN":"Panama",\
"PCN":"Pitcairn",\
"PER":"Peru",\
"PHL":"Philippines",\
"PLW":"Palau",\
"PNG":"Papua New Guinea",\
"POL":"Poland",\
"PRI":"Puerto Rico",\
"PRK":"Korea, Democratic People's Republic of",\
"PRT":"Portugal",\
"PRY":"Paraguay",\
"PSE":"Palestinian Territory, Occupied",\
"PYF":"French Polynesia",\
"QAT":"Qatar",\
"REU":"Réunion",\
"ROU":"Romania",\
"RUS":"Russian Federation",\
"RWA":"Rwanda",\
"SAU":"Saudi Arabia",\
"SDN":"Sudan",\
"SEN":"Senegal",\
"SGP":"Singapore",\
"SGS":"South Georgia and the South Sandwich Islands",\
"SHN":"Saint Helena",\
"SJM":"Svalbard and Jan Mayen",\
"SLB":"Solomon Islands",\
"SLE":"Sierra Leone",\
"SLV":"El Salvador",\
"SMR":"San Marino",\
"SOM":"Somalia",\
"SPM":"Saint Pierre and Miquelon",\
"SRB":"Serbia",\
"STP":"Sao Tome and Principe",\
"SUR":"Suriname",\
"SVK":"Slovakia",\
"SVN":"Slovenia",\
"SWE":"Sweden",\
"SWZ":"Swaziland",\
"SYC":"Seychelles",\
"SYR":"Syrian Arab Republic",\
"TCA":"Turks and Caicos Islands",\
"TCD":"Chad",\
"TGO":"Togo",\
"THA":"Thailand",\
"TJK":"Tajikistan",\
"TKL":"Tokelau",\
"TKM":"Turkmenistan",\
"TLS":"Timor-Leste",\
"TON":"Tonga",\
"TTO":"Trinidad and Tobago",\
"TUN":"Tunisia",\
"TUR":"Turkey",\
"TUV":"Tuvalu",\
"TWN":"Taiwan, Province of China",\
"TZA":"Tanzania, United Republic of",\
"UGA":"Uganda",\
"UKR":"Ukraine",\
"UMI":"United States Minor Outlying Islands",\
"URY":"Uruguay",\
"USA":"United States",\
"UTO":"Utopia",\
"UZB":"Uzbekistan",\
"VAT":"Holy See (Vatican City State)",\
"VCT":"Saint Vincent and the Grenadines",\
"VEN":"Venezuela",\
"VGB":"Virgin Islands, British",\
"VIR":"Virgin Islands, U.S.",\
"VNM":"Viet Nam",\
"VUT":"Vanuatu",\
"WLF":"Wallis and Futuna",\
"WSM":"Samoa",\
"YEM":"Yemen",\
"ZAF":"South Africa",\
"ZMB":"Zambia",\
"ZWE":"Zimbabwe",\
"UNO":"United Nations Organization",\
"UNA":"United Nations specialized agency official",\
"XXA":"Stateless",\
"XXB":"Refugee",\
"XXC":"Refugee (non-convention)",\
"XXX":"Unspecified / Unknown",\
}
# combined ISO-3166 country and icar.org manufacturer codes
ISO3166CountryCodes= {'004':'Afghanistan',\
'248':'Åland Islands',\
'008':'Albania',\
'012':'Algeria',\
'016':'American Samoa',\
'020':'Andorra',\
'024':'Angola',\
'660':'Anguilla',\
'010':'Antarctica',\
'028':'Antigua and Barbuda',\
'032':'Argentina',\
'051':'Armenia',\
'533':'Aruba',\
'036':'Australia',\
'040':'Austria',\
'031':'Azerbaijan',\
'044':'Bahamas',\
'048':'Bahrain',\
'050':'Bangladesh',\
'052':'Barbados',\
'112':'Belarus',\
'056':'Belgium',\
'084':'Belize',\
'204':'Benin',\
'060':'Bermuda',\
'064':'Bhutan',\
'068':'Bolivia',\
'070':'Bosnia and Herzegovina',\
'072':'Botswana',\
'074':'Bouvet Island',\
'076':'Brazil',\
'086':'British Indian Ocean Territory',\
'096':'Brunei Darussalam',\
'100':'Bulgaria',\
'854':'Burkina Faso',\
'108':'Burundi',\
'116':'Cambodia',\
'120':'Cameroon',\
'124':'Canada',\
'132':'Cape Verde',\
'136':'Cayman Islands',\
'140':'Central African Republic',\
'148':'Chad',\
'152':'Chile',\
'156':'China',\
'162':'Christmas Island',\
'166':'Cocos (Keeling) Islands',\
'170':'Colombia',\
'174':'Comoros',\
'178':'Congo',\
'180':'Congo, the Democratic Republic of the',\
'184':'Cook Islands',\
'188':'Costa Rica',\
'384':'Côte d\'Ivoire',\
'191':'Croatia',\
'192':'Cuba',\
'196':'Cyprus',\
'203':'Czech Republic',\
'208':'Denmark',\
'262':'Djibouti',\
'212':'Dominica',\
'214':'Dominican Republic',\
'218':'Ecuador',\
'818':'Egypt',\
'222':'El Salvador',\
'226':'Equatorial Guinea',\
'232':'Eritrea',\
'233':'Estonia',\
'231':'Ethiopia',\
'238':'Falkland Islands (Malvinas)',\
'234':'Faroe Islands',\
'242':'Fiji',\
'246':'Finland',\
'250':'France',\
'254':'French Guiana',\
'258':'French Polynesia',\
'260':'French Southern Territories',\
'266':'Gabon',\
'270':'Gambia',\
'268':'Georgia',\
'276':'Germany',\
'288':'Ghana',\
'292':'Gibraltar',\
'300':'Greece',\
'304':'Greenland',\
'308':'Grenada',\
'312':'Guadeloupe',\
'316':'Guam',\
'320':'Guatemala',\
'831':'Guernsey',\
'324':'Guinea',\
'624':'Guinea-Bissau',\
'328':'Guyana',\
'332':'Haiti',\
'334':'Heard Island and McDonald Islands',\
'336':'Holy See (Vatican City State)',\
'340':'Honduras',\
'344':'Hong Kong',\
'348':'Hungary',\
'352':'Iceland',\
'356':'India',\
'360':'Indonesia',\
'364':'Iran, Islamic Republic of',\
'368':'Iraq',\
'372':'Ireland',\
'833':'Isle of Man',\
'376':'Israel',\
'380':'Italy',\
'388':'Jamaica',\
'392':'Japan',\
'832':'Jersey',\
'400':'Jordan',\
'398':'Kazakhstan',\
'404':'Kenya',\
'296':'Kiribati',\
'408':'Korea, Democratic People\'s Republic of',\
'410':'Korea, Republic of',\
'414':'Kuwait',\
'417':'Kyrgyzstan',\
'418':'Lao People\'s Democratic Republic',\
'428':'Latvia',\
'422':'Lebanon',\
'426':'Lesotho',\
'430':'Liberia',\
'434':'Libyan Arab Jamahiriya',\
'438':'Liechtenstein',\
'440':'Lithuania',\
'442':'Luxembourg',\
'446':'Macao',\
'807':'Macedonia, the former Yugoslav Republic of',\
'450':'Madagascar',\
'454':'Malawi',\
'458':'Malaysia',\
'462':'Maldives',\
'466':'Mali',\
'470':'Malta',\
'584':'Marshall Islands',\
'474':'Martinique',\
'478':'Mauritania',\
'480':'Mauritius',\
'175':'Mayotte',\
'484':'Mexico',\
'583':'Micronesia, Federated States of',\
'498':'Moldova, Republic of',\
'492':'Monaco',\
'496':'Mongolia',\
'499':'Montenegro',\
'500':'Montserrat',\
'504':'Morocco',\
'508':'Mozambique',\
'104':'Myanmar',\
'516':'Namibia',\
'520':'Nauru',\
'524':'Nepal',\
'528':'Netherlands',\
'530':'Netherlands Antilles',\
'540':'New Caledonia',\
'554':'New Zealand',\
'558':'Nicaragua',\
'562':'Niger',\
'566':'Nigeria',\
'570':'Niue',\
'574':'Norfolk Island',\
'580':'Northern Mariana Islands',\
'578':'Norway',\
'512':'Oman',\
'586':'Pakistan',\
'585':'Palau',\
'275':'Palestinian Territory, Occupied',\
'591':'Panama',\
'598':'Papua New Guinea',\
'600':'Paraguay',\
'604':'Peru',\
'608':'Philippines',\
'612':'Pitcairn',\
'616':'Poland',\
'620':'Portugal',\
'630':'Puerto Rico',\
'634':'Qatar',\
'638':'Réunion',\
'642':'Romania',\
'643':'Russian Federation',\
'646':'Rwanda',\
'654':'Saint Helena',\
'659':'Saint Kitts and Nevis',\
'662':'Saint Lucia',\
'666':'Saint Pierre and Miquelon',\
'670':'Saint Vincent and the Grenadines',\
'882':'Samoa',\
'674':'San Marino',\
'678':'Sao Tome and Principe',\
'682':'Saudi Arabia',\
'686':'Senegal',\
'688':'Serbia',\
'690':'Seychelles',\
'694':'Sierra Leone',\
'702':'Singapore',\
'703':'Slovakia',\
'705':'Slovenia',\
'090':'Solomon Islands',\
'706':'Somalia Somalia',\
'710':'South Africa',\
'239':'South Georgia and the South Sandwich Islands',\
'724':'Spain',\
'144':'Sri Lanka',\
'736':'Sudan',\
'740':'Suriname',\
'744':'Svalbard and Jan Mayen',\
'748':'Swaziland',\
'752':'Sweden',\
'756':'Switzerland',\
'760':'Syrian Arab Republic',\
'158':'Taiwan, Province of China',\
'762':'Tajikistan',\
'834':'Tanzania, United Republic of',\
'764':'Thailand',\
'626':'Timor-Leste',\
'768':'Togo',\
'772':'Tokelau',\
'776':'Tonga',\
'780':'Trinidad and Tobago',\
'788':'Tunisia',\
'792':'Turkey',\
'795':'Turkmenistan',\
'796':'Turks and Caicos Islands',\
'798':'Tuvalu',\
'800':'Uganda',\
'804':'Ukraine',\
'784':'United Arab Emirates',\
'826':'United Kingdom',\
'840':'United States',\
'581':'United States Minor Outlying Islands',\
'858':'Uruguay',\
'860':'Uzbekistan',\
'548':'Vanuatu',\
'862':'Venezuela',\
'704':'Viet Nam',\
'092':'Virgin Islands, British',\
'850':'Virgin Islands, U.S.',\
'876':'Wallis and Futuna',\
'732':'Western Sahara',\
'887':'Yemen',\
'894':'Zambia',\
'716':'Zimbabwe',\
'985':'MANUF: Destron Fearing / Digital Angel Corporation',\
'984':'MANUF: Nedap',\
'983':'MANUF: Texas Instruments',\
'982':'MANUF: Allflex',\
'981':'MANUF: Datamars',\
'980':'MANUF: AGRIDENT BV',\
'979':'MANUF: Earlsmere I.D.',\
'978':'MANUF: IER SA',\
'977':'MANUF: Avid',\
'976':'MANUF: Gemplus',\
'975':'MANUF: Sokymat',\
'974':'MANUF: Impro',\
'973':'MANUF: Fujihira',\
'972':'MANUF: Planet ID',\
'971':'MANUF: Alfa Laval Agri',\
'970':'MANUF: Amphenol',\
'969':'MANUF: Caisley',\
'968':'MANUF: AEG',\
'967':'MANUF: Rfdynamics',\
'966':'MANUF: PetCode',\
'965':'MANUF: 4D Technology Co. Ltd.',\
'964':'MANUF: Rumitag S.L.',\
'963':'MANUF: Korth Eletro Mecanica LTDA',\
'962':'MANUF: DigiTag A/S',\
'961':'MANUF: Mannings I.A.I.D.',\
'960':'MANUF: Chevillot',\
'959':'MANUF: Global ID Technologies',\
'958':'MANUF: Pet ID',\
'957':'MANUF: Innoceramics',\
'956':'MANUF: Trovan Ltd.',\
'955':'MANUF: Reseaumatique',\
'954':'MANUF: Ryeflex',\
'953':'MANUF: Cromasa',\
'952':'MANUF: JECTA',\
'951':'MANUF: Leader Products Pty Ltd',\
'950':'MANUF: SPLICE do Brasil Telecomunicacoes e Eletronica S.A.',\
'949':'MANUF: Y-Tex Corporation',\
'948':'MANUF: H. Hauptner und Richard Herberholz GmbH & Co. KG',\
'947':'MANUF: BELCAM. ID',\
'946':'MANUF: Advanced Ceramics Limited',\
'945':'MANUF: Business Inception Identification B.V.',\
'944':'MANUF: Net & Telligent SA',\
'943':'MANUF: E-Mark Technologie & Development',\
'942':'MANUF: Zee Tags',\
'941':'MANUF: Felixcan S.L.',\
'940':'MANUF: Shearwell Data Ltd.',\
'939':'MANUF: RealTrace',\
'938':'MANUF: INSVET',\
'937':'MANUF: ID & Traceback Systems AS',\
'936':'MANUF: CROVET, S.L.',\
'935':'MANUF: VeriLogik, Inc.',\
'900':'MANUF: Shared (see http://www.icar.org/manufacturer_codes.htm)',\
'1022':'UNREGISTERED MANUF: VeriChip Corporation'}