forked from fedora-copr/copr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.html
74 lines (66 loc) · 2.1 KB
/
api.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{% extends "layout.html" %}
{% block title %}API for Copr{% endblock %}
{% block header %}API for the Copr Build System{% endblock %}
{%block main_menu_api %}active{% endblock %}
{% block breadcrumbs %}
<ol class="breadcrumb">
<li>
<a href="{{ url_for('coprs_ns.coprs_show') }}">Home</a>
</li>
<li class="active">
API
</li>
</ol>
{% endblock %}
{% block body %}
{% if error %}<p class="error"><strong>Error:</strong> {{ error }}</p>{% endif %}
<div>
<h1>Copr API</h1>
<h2>API Token</h2>
<p>In order to access the restricted parts of the API, you will need to provide an API token.
This token is unique, specific to you and <span style="font-weight:bold;">
should not be shared!</span>.
</p>
<p>The API token is valid for {{ config['API_TOKEN_EXPIRATION'] }} days after it has been generated.
</p>
{% include 'additional_token_info.html' %}
{% if g.user %}
<pre style="font-size:120%">
[copr-cli]
login = {{ g.user.api_login }}
username = {{ g.user.name }}
token = {{ g.user.api_token }}
copr_url = {{ ('https://' + config['PUBLIC_COPR_HOSTNAME'])| fix_url_https_frontend}}
{% if config['ENFORCE_PROTOCOL_FOR_FRONTEND_URL'] == 'http' %}
encrypted = False
{% endif %}
# expiration date: {{ g.user.api_token_expiration }}
</pre>
<a href="{{ url_for('api_ns.api_new_token') }}">
<input type="button" value="Generate a new token" />
</a>
{% else %}
<pre style="font-size:120%">
[copr-cli]
login = LOGIN_TO_REVEAL
username = LOGIN_TO_REVEAL
token = LOGIN_TO_REVEAL
copr_url = {{ ('https://' + config['PUBLIC_COPR_HOSTNAME'])| fix_url_https_frontend}}
{% if config['ENFORCE_PROTOCOL_FOR_FRONTEND_URL'] == 'http' %}
encrypted = False
{% endif %}
# expiration date: LOGIN_TO_REVEAL
</pre>
<p style="font-style:italic">You need to be logged in to see your API token.</p>
{% endif %}
<h2>Documentation</h2>
<ul>
<li><a href="/api_3/docs">API documentation</a></li>
<li>
<a href="https://python-copr.readthedocs.io/en/latest/index.html">
Python client documentation
</a>
</li>
</ul>
</div>
{% endblock %}