14
14
# 3-digit ISO 3166-1 alpha-3, codes, with 'all', 'ALL', and 'All' appended ot
15
15
# the end.
16
16
17
+ WB_API_URL = 'https://api.worldbank.org/v2'
18
+
17
19
country_codes = ['AD' , 'AE' , 'AF' , 'AG' , 'AI' , 'AL' , 'AM' , 'AO' , 'AQ' , 'AR' ,
18
20
'AS' , 'AT' , 'AU' , 'AW' , 'AX' , 'AZ' , 'BA' , 'BB' , 'BD' , 'BE' ,
19
21
'BF' , 'BG' , 'BH' , 'BI' , 'BJ' , 'BL' , 'BM' , 'BN' , 'BO' , 'BQ' ,
@@ -158,8 +160,7 @@ def __init__(self, symbols=None, countries=None,
158
160
@property
159
161
def url (self ):
160
162
countries = ';' .join (self .countries )
161
- return ("http://api.worldbank.org/countries/" +
162
- countries + "/indicators/" )
163
+ return WB_API_URL + '/countries/' + countries + '/indicators/'
163
164
164
165
@property
165
166
def params (self ):
@@ -251,7 +252,7 @@ def get_countries(self):
251
252
country code, region, income level,
252
253
capital city, latitude, and longitude
253
254
"""
254
- url = 'http://api.worldbank.org /countries/?per_page=1000&format=json'
255
+ url = WB_API_URL + ' /countries/?per_page=1000&format=json'
255
256
256
257
resp = self ._get_response (url )
257
258
data = resp .json ()[1 ]
@@ -274,7 +275,7 @@ def get_indicators(self):
274
275
if isinstance (_cached_series , pd .DataFrame ):
275
276
return _cached_series .copy ()
276
277
277
- url = 'http://api.worldbank.org /indicators?per_page=50000&format=json'
278
+ url = WB_API_URL + ' /indicators?per_page=50000&format=json'
278
279
279
280
resp = self ._get_response (url )
280
281
data = resp .json ()[1 ]
0 commit comments