Commit dfd68f69 authored by Bruno Duyé's avatar Bruno Duyé
Browse files

Add --debug-http option

parent 42796c5e
......@@ -32,6 +32,7 @@ Options:
-k --keep-existing do not erase existing files in target_dir, and do not re-download existing ones
--only <datasets_codes> convert given dataset(s)_code(s), comma-separated. Ex: "--only commodity_prices,GEM"
-l --limit_nb_dataset_series <number> limit the number of series to download per dataset
--debug-http show requests headers
Note: target_dir will be cleared.
"""
......@@ -39,6 +40,7 @@ Note: target_dir will be cleared.
# API doc is available at https://datahelpdesk.worldbank.org/knowledgebase/topics/125589
# API online test: http://search.worldbank.org/api/v2/projects
import http
import json
import logging
import os
......@@ -79,6 +81,8 @@ def main():
target_dir = args['<target_dir>']
debug_mode = args['--debug']
logging.basicConfig(level=(logging.DEBUG if debug_mode else logging.INFO), format='%(message)s')
if args['--debug-http']:
http.client.HTTPConnection.debuglevel = 1
# download data using API
# datasets informations
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment