Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 40e2f31081093569df699eb11a858fc8 > files > 59

python-copr-doc-1.94-1.mga7.noarch.rpm

Working with proxies directly
=============================

In all sample codes, it is used Client to provide proxy objects (``project_proxy``, ``build_proxy``, etc). However, that
is not the only way how to do it. Proxy classes can be also initialized directly.


Following code samples are equal.

.. code-block:: python

    from copr.v3 import Client
    client = Client.create_from_config_file()
    build = client.build_proxy.get(123)


Same thing without using Client.

.. code-block:: python

    from copr.v3 import BuildProxy
    config = {"username": "frostyx", , "copr_url": "https://copr.fedorainfracloud.org/",
              "login": "somehash", "token": "someotherhash"}
    build_proxy = BuildProxy(config)
    build = build_proxy.get(123)