Discussion:
Python client - new build from SPEC file
Petr Stefan
2018-12-04 21:08:16 UTC
Permalink
Hi,

I'm using COPR for building couple of projects for Fedora and CentOS. Now I want to create a python script for making the release process more comfortable (create tag in git repository, updating my spec file and hopefully upload the file to the COPR). I've found python-copr library and it works fine when I want for example to get list of existing builds. However, creating a new build fails with CoprRequestException (Login invalid/expired. Please visit https://copr.fedorainfracloud.org/api to get or renew your API token.). But I guess my token is ok, because it's freshly generated and works with other endpoins.

My code is as simple as this:
----------
from copr.v3 import BuildProxy
build_proxy = BuildProxy.create_from_config_file()
result = build_proxy.create_from_file("user", "project", "spec/file/path.spec")
----------

Is there any solution to my problem? Thanks,
/semai
_______________________________________________
copr-devel mailing list -- copr-***@lists.fedorahosted.org
To unsubscribe send an email to copr-devel-***@lists.fedorahosted.org
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/copr-***@lists.fedorahoste
Jakub Kadlcik
2018-12-05 22:21:20 UTC
Permalink
Hello Petr,
Post by Petr Stefan
I want to create a python script for making the release process more
comfortable (create tag in git repository, updating my spec file and
hopefully upload the file to the COPR).

Just to make sure, that you are not reinventing the wheel by mistake. Do
you know tito [1] and rpkg [2] projects? They do exactly what you are
describing, so if you never heard of them, you should definitely check them
;-)
I tried your code and it works for me. Isn't somehow possible, that you
indeed have a wrong API token? The create_from_config_file() function by
default uses the ~/.config/copr file. Please make sure that it exists, has
only one [copr-cli] section and it looks like this

[copr-cli]
login = mysecretlogin
username = frostyx
token = mysecrettoken
copr_url = https://copr.fedorainfracloud.org
# expiration date: 2019-05-04

Please check the expiration date of your token and also that it is equal to
https://copr.fedorainfracloud.org/api/ .

[1] https://github.com/dgoodwin/tito/
[2] https://pagure.io/rpkg-util


Jakub
Post by Petr Stefan
Hi,
I'm using COPR for building couple of projects for Fedora and CentOS. Now
I want to create a python script for making the release process more
comfortable (create tag in git repository, updating my spec file and
hopefully upload the file to the COPR). I've found python-copr library and
it works fine when I want for example to get list of existing builds.
However, creating a new build fails with CoprRequestException (Login
invalid/expired. Please visit https://copr.fedorainfracloud.org/api to
get or renew your API token.). But I guess my token is ok, because it's
freshly generated and works with other endpoins.
----------
from copr.v3 import BuildProxy
build_proxy = BuildProxy.create_from_config_file()
result = build_proxy.create_from_file("user", "project",
"spec/file/path.spec")
----------
Is there any solution to my problem? Thanks,
/semai
_______________________________________________
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
Loading...