Skip to content

Instantly share code, notes, and snippets.

View pavelschon's full-sized avatar

Pavel Schön pavelschon

View GitHub Profile
@pavelschon
pavelschon / cnb_import.py
Created April 24, 2022 15:52
Import ČNB rates (denní kurz)
#!/usr/bin/env python3
import csv
import codecs
import requests
class CNB:
'''CNB CSV dialect'''
@pavelschon
pavelschon / BoostPythonTranslateException.h
Created August 26, 2016 19:49
Translate Python exception into C++ exception (Boost::Python)
/**
* @brief Generic Python-to-C++ exception translator
* Caller provides C++ exception class, callback(), list of Python exceptions,
* which should be be handled and optional parameters to callback
*
* @param callback object, usually python function, lambda function, functor, std::bind expression or std::function
* @param exceptions list of python exceptions, e.g. { PyExc_ValueError, PyExc_TypeError }
* @param params optional parameters to callback()
* @return decltype - return value of the callback()
*