|
22 | 22 | """This script downloads the list of states and countries and their |
23 | 23 | birthplace code from the National Registration Department of Malaysia.""" |
24 | 24 |
|
| 25 | +import os |
25 | 26 | import re |
26 | 27 | from collections import defaultdict |
27 | 28 |
|
@@ -61,19 +62,20 @@ def parse(content): |
61 | 62 |
|
62 | 63 |
|
63 | 64 | if __name__ == '__main__': |
| 65 | + ca_certificate = os.path.join(os.path.dirname(__file__), 'my_bp.crt') |
64 | 66 | headers = { |
65 | 67 | 'User-Agent': user_agent, |
66 | 68 | } |
67 | 69 | results = defaultdict(lambda: defaultdict(set)) |
68 | 70 | # read the states |
69 | | - response = requests.get(state_list_url, headers=headers, verify='update/my_bp.crt', timeout=30) |
| 71 | + response = requests.get(state_list_url, headers=headers, verify=ca_certificate, timeout=30) |
70 | 72 | response.raise_for_status() |
71 | 73 | for state, bps in parse(response.content): |
72 | 74 | for bp in bps: |
73 | 75 | results[bp]['state'] = state |
74 | 76 | results[bp]['countries'].add('Malaysia') |
75 | 77 | # read the countries |
76 | | - response = requests.get(country_list_url, headers=headers, verify='update/my_bp.crt', timeout=30) |
| 78 | + response = requests.get(country_list_url, headers=headers, verify=ca_certificate, timeout=30) |
77 | 79 | response.raise_for_status() |
78 | 80 | for country, bps in parse(response.content): |
79 | 81 | for bp in bps: |
|
0 commit comments