On 2011-06-22 17:24:12 +0300, Mihnea Dobrescu-Balaur wrote:
Hello,
I'm having trouble using the osc python bindings and was hoping I could get some help here.
I'm at the part of figuring out who the maintainer/bug owner of a package is. I managed to do it in the shell, but I am trying to do it via the osc library.
My problem is using the meta_exists function from osc.core. I've tried various ways of calling it and I've got no success. The source on gitourious[0] isn't commented so it doesn't really help.
Some sample output:
osc.core.meta_exists(metatype='prj', path_args='openSUSE:Factory') makeurl: https://api.opensuse.org ['source/openSUSE:Factory/_meta'] []
-- GET https://api.opensuse.org/source/openSUSE:Factory/_meta Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/site-packages/osc/core.py", line 2954, in meta_exists data = http_GET(url).readlines() File "/usr/lib/python2.7/site-packages/osc/core.py", line 2661, in http_GET def http_GET(*args, **kwargs): return http_request('GET', *args, **kwargs) File "/usr/lib/python2.7/site-packages/osc/core.py", line 2600, in http_request if conf.is_known_apiurl(url): File "/usr/lib/python2.7/site-packages/osc/conf.py", line 333, in is_known_apiurl return config['api_host_options'].has_key(apiurl) KeyError: 'api_host_options'
I don't really understand what's happening. That url after GET is OK and it actually contains the meta information that I need.
Before you can use osc you have to call osc.conf.get_config() (which requires a ~/.oscrc - it's also possible to specify a different path for the config: osc.conf.get_config(override_conffile='/path/to/oscrc')). Afterwards it should work as expected. I know it is quite "hard" to use the current osc code in a different application but we're currently rewriting the existing code... so it will (probably) be easier in the future:) Marcus -- To unsubscribe, e-mail: opensuse-project+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-project+help@opensuse.org