Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc10b01e

Browse files
author
Gauvain Pocentek
committed
move documentation and todo to README.md
1 parenta02180d commitc10b01e

File tree

3 files changed

+57
-33
lines changed

3 files changed

+57
-33
lines changed

‎README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
##Python GitLab
2+
3+
python-gitlab is a Python module providing access to the GitLab server API.
4+
5+
It supports the v3 api of GitLab.
6+
7+
##Requirements
8+
9+
Only Python 2 is supported for the moment.
10+
11+
python-gitlab depends on[python-requests](http://docs.python-requests.org/en/latest/).
12+
13+
##State
14+
15+
python-gitlab is a work in progress, although already usable. Changes in the API might happen.
16+
17+
##ToDo
18+
19+
* Improve documentation
20+
* Write unit tests
21+
* Write a command line tool to access GitLab servers
22+
23+
##Code snippet
24+
25+
`````python
26+
# See https://github.com/gitlabhq/gitlabhq/tree/master/doc/api for the source.
27+
28+
# Register a connection to a gitlab instance, using its URL and a user private
29+
# token
30+
gl= Gitlab('http://192.168.123.107','JVNSESs8EwWRx5yDxM5q')
31+
# Connect to get the current user
32+
gl.auth()
33+
# Print the user informations
34+
print gl.user
35+
36+
# Get a list of projects
37+
for pin gl.Project():
38+
print (p.name)
39+
# get associated issues
40+
issues= p.Issue()
41+
for issuein issues:
42+
closed=0ifnot issue.closedelse1
43+
print ("%d =>%s (closed:%d)"% (issue.id, issue.title, closed))
44+
# and close them all
45+
issue.closed=1
46+
issue.save()
47+
48+
# Get the first 10 groups (pagination)
49+
for gin gl.Group(page=1,per_page=10):
50+
print (g)
51+
52+
# Create a new project
53+
p= gl.Project({'name':'myCoolProject','wiki_enabled':False})
54+
p.save()
55+
print p
56+
`````
57+

‎TODO

Lines changed: 0 additions & 4 deletions
This file was deleted.

‎gitlab.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -619,32 +619,3 @@ def Tag(self, id=None, **kwargs):
619619
returnself._getListOrObject(ProjectTag,id,
620620
project_id=self.id,
621621
**kwargs)
622-
623-
624-
if__name__=='__main__':
625-
# Quick "doc"
626-
#
627-
# See https://github.com/gitlabhq/gitlabhq/tree/master/doc/api for the
628-
# source
629-
630-
# Register a connection to a gitlab instance, using its URL and a user
631-
# private token
632-
gl=Gitlab('http://192.168.123.107:8080','JVNSESs8EwWRx5yDxM5q')
633-
# Connect to get the current user (as gl.user)
634-
gl.auth()
635-
636-
# get a list of projects
637-
forpingl.Project():
638-
printp.name
639-
# get associated issues
640-
issues=p.Issue()
641-
forissueinissues:
642-
closed=0ifnotissue.closedelse1
643-
print" %d => %s (closed: %d)"% (issue.id,issue.title,closed)
644-
# and close them all
645-
issue.closed=1
646-
issue.save()
647-
648-
# get the first 10 groups (pagination)
649-
forgingl.Group(page=1,per_page=10):
650-
printg

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp