@@ -25,7 +25,7 @@ pip install python-gitlab
25
25
26
26
python-gitlab is considered stable.
27
27
28
- ## Bugs reports
28
+ ## Bug reports
29
29
30
30
Please report bugs and feature requests at
31
31
https://github.com/gpocentek/python-gitlab/issues
@@ -51,10 +51,10 @@ gl.auth()
51
51
print (gl.user)
52
52
53
53
# Get a list of projects
54
- for p in gl.Project ():
54
+ for p in gl.projects.list ():
55
55
print (p.name)
56
56
# get associated issues
57
- issues = p.Issue ()
57
+ issues = p.issues.list ()
58
58
for issue in issues:
59
59
closed = 0 if not issue.closed else 1
60
60
print (" %d => %s (closed: %d )" % (issue.id, issue.title, closed))
@@ -63,23 +63,23 @@ for p in gl.Project():
63
63
issue.save()
64
64
65
65
# Get the first 10 groups (pagination)
66
- for g in gl.Group (page = 1 , per_page = 10 ):
66
+ for g in gl.groups.list (page = 1 , per_page = 10 ):
67
67
print (g)
68
68
69
69
# To use pagination and retrieve all the items
70
- for g in gl.Group (all = True ):
70
+ for g in gl.groups.list (all = True ):
71
71
print (g)
72
72
73
73
# Create a new project (as another_user)
74
- p = gl.Project ({' name' : ' myCoolProject' , ' wiki_enabled' : False })
75
- p.save( sudo = " another_user" )
74
+ p = gl.project.create ({' name' : ' myCoolProject' , ' wiki_enabled' : False },
75
+ sudo = " another_user" )
76
76
print (p)
77
77
`````
78
78
79
79
## Command line use
80
80
81
81
To use the command line tool, you need to define which GitLab server(s) can be
82
- accessed. this can be done in 2 files:
82
+ accessed. This can be done in 2 files:
83
83
84
84
* /etc/python-gitlab.cfg
85
85
* ~ /.python-gitlab.cfg
@@ -116,16 +116,16 @@ validated (use false for self signed certificates, only useful with https).
116
116
The ` timeout ` option defines after how many seconds a request to the Gitlab
117
117
server should be abandonned.
118
118
119
- Choosing a different server than the default one can be done at run time:
119
+ You can choose a different server than the default one at run time:
120
120
121
121
`````
122
- gitlab --gitlab= remote [command]
122
+ gitlab --gitlab remote [command]
123
123
`````
124
124
125
125
gitlab always requires 2 mandatory arguments.
126
126
127
- The first argument is the object type on which we will act, the second one is
128
- the action:
127
+ The first argument is the object type on which the program will act, the second
128
+ one is the action:
129
129
130
130
`````
131
131
gitlab project list
@@ -148,24 +148,24 @@ Some examples:
148
148
gitlab project list
149
149
150
150
# limit to 5 items per request, display the 1st page only
151
- gitlab project list --page= 1 --per-page= 5
151
+ gitlab project list --page 1 --per-page 5
152
152
153
153
# get a specific project (id 2):
154
- gitlab project get --id= 2
154
+ gitlab project get --id 2
155
155
156
156
# get a list of snippets for this project:
157
- gitlab project-issue list --project-id= 2
157
+ gitlab project-issue list --project-id 2
158
158
159
159
# delete a Snippet (id 3):
160
- gitlab project-snippet delete --id= 3 --project-id= 2
160
+ gitlab project-snippet delete --id 3 --project-id 2
161
161
162
162
# update a Snippet:
163
- gitlab project-snippet update --id= 4 --project-id= 2 --code= " My New Code"
163
+ gitlab project-snippet update --id 4 --project-id 2 --code " My New Code"
164
164
165
165
# create a Snippet:
166
- gitlab project-snippet create --project-id= 2
166
+ gitlab project-snippet create --project-id 2
167
167
Impossible to create object (Missing attribute(s): title, file-name, code)
168
168
169
169
# oops, let's add the attributes:
170
- gitlab project-snippet create --project-id= 2 --title= " the title" --file-name= " the name" --code= " the code"
170
+ gitlab project-snippet create --project-id 2 --title " the title" --file-name " the name" --code " the code"
171
171
`````
0 commit comments