File tree Expand file tree Collapse file tree 13 files changed +328
-100
lines changed Open diff view settings
Expand file tree Collapse file tree 13 files changed +328
-100
lines changed Open diff view settings
Original file line number Diff line number Diff line change 1- ############################
2- Getting started with the API
3- ############################
1+ ##################
2+ Using the REST API
3+ ##################
44
5- python-gitlab only supports GitLab API v4 .
5+ python-gitlab currently only supports v4 of the GitLab REST API .
66
77``gitlab.Gitlab `` class
88=======================
Original file line number Diff line number Diff line change 1- ############################
2- Getting started with the CLI
3- ############################
1+ #############
2+ Using the CLI
3+ #############
44
55``python-gitlab `` provides a :command: `gitlab ` command-line tool to interact
66with GitLab servers.
Original file line number Diff line number Diff line change 1+ #####################
2+ Using the GraphQL API
3+ #####################
4+
5+ python-gitlab provides basic support for executing GraphQL queries and mutations.
6+
7+ .. danger ::
8+
9+ The GraphQL client is experimental and only provides basic support.
10+ It does not currently support pagination, obey rate limits,
11+ or attempt complex retries. You can use it to build simple queries
12+
13+ It is currently unstable and its implementation may change. You can expect a more
14+ mature client in one of the upcoming major versions.
15+
16+ The ``gitlab.GraphQLGitlab `` class
17+ ==================================
18+
19+ As with the REST client, you connect to a GitLab instance by creating a ``gitlab.GraphQLGitlab `` object:
20+
21+ .. code-block :: python
22+
23+ import gitlab
24+
25+ # anonymous read-only access for public resources (GitLab.com)
26+ gl = gitlab.GraphQLGitlab()
27+
28+ # anonymous read-only access for public resources (self-hosted GitLab instance)
29+ gl = gitlab.GraphQLGitlab(' https://gitlab.example.com' )
30+
31+ # private token or personal token authentication (GitLab.com)
32+ gl = gitlab.GraphQLGitlab(private_token = ' JVNSESs8EwWRx5yDxM5q' )
33+
34+ # private token or personal token authentication (self-hosted GitLab instance)
35+ gl = gitlab.GraphQLGitlab(url = ' https://gitlab.example.com' , private_token = ' JVNSESs8EwWRx5yDxM5q' )
36+
37+ # oauth token authentication
38+ gl = gitlab.GraphQLGitlab(' https://gitlab.example.com' , oauth_token = ' my_long_token_here' )
39+
40+ Sending queries
41+ ===============
42+
43+ Get the result of a simple query:
44+
45+ .. code-block :: python
46+
47+ query = """ {
48+ query {
49+ currentUser {
50+ name
51+ }
52+ }
53+ """
54+
55+ result = gl.execute(query)
Original file line number Diff line number Diff line change 77 cli-usage
88 api-usage
99 api-usage-advanced
10+ graphql-api-usage
1011 cli-examples
1112 api-objects
1213 api/gitlab
Original file line number Diff line number Diff line change 2929 __title__ ,
3030 __version__ ,
3131)
32- from gitlab .client import Gitlab , GitlabList # noqa: F401
32+ from gitlab .client import Gitlab , GitlabList , GraphQLGitlab # noqa: F401
3333from gitlab .exceptions import * # noqa: F401,F403
3434
3535warnings .filterwarnings ("default" , category = DeprecationWarning , module = "^gitlab" )
You can’t perform that action at this time.
0 commit comments