J535D165 / cbsodata

Unofficial Statistics Netherlands (CBS) open data API client for Python
http://cbsodata.readthedocs.io/
MIT License
42 stars 17 forks source link

Add option to pass other settings to requests lib #13

Closed J535D165 closed 4 years ago

J535D165 commented 4 years ago

Solution for #12.

1) Parameters like proxies, verify and cert can be passed to every request in cbsodata. 2) Define global values for parameters like proxies, verify and cert with the cbsodata.options.requests setting.

In [1]: import cbsodata                                                                             

In [3]: cbsodata.options.requests['verify'] = "xyz"                                                          

In [4]: cbsodata.options.requests['verify']                                                                  
Out[4]: 'xyz'

In [5]: cbsodata.get_info("82070ENG")                                                               
Out[5]: 
{'ID': 0,
 'Title': 'Caribbean Netherlands; employed labour force characteristics 2012',
 'ShortTitle': 'Caribbean NL; employed 2012',
 'Identifier': '82070ENG',
 'Summary': 'Employed labour force national and international definition\nby sex by position in the labour force and gross monthly income',
 'Modified': '2013-11-28T15:00:00',
....

In [6]: cbsodata.get_info("82070ENG", verify=True)                                                  
Out[6]: 
{'ID': 0,
 'Title': 'Caribbean Netherlands; employed labour force characteristics 2012',
 'ShortTitle': 'Caribbean NL; employed 2012',
 'Identifier': '82070ENG',
 'Summary': 'Employed labour force national and international definition\nby sex by position in the 
...
J535D165 commented 4 years ago

@joosbuijsNL can you test this implementation?

joosbuijsNL commented 4 years ago

@joosbuijsNL can you test this implementation?

Confirmed, this works! Thanks a lot! :)

J535D165 commented 4 years ago

Closes #12