Add .baseurl getter to Python and C APIs.

also added a simple test case.