Skip to content

Commit c10b01e

Browse files
author
Gauvain Pocentek
committed
move documentation and todo to README.md
1 parent a02180d commit c10b01e

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 p in gl.Project():
38+
print (p.name)
39+
# get associated issues
40+
issues = p.Issue()
41+
for issue in issues:
42+
closed = 0 if not issue.closed else 1
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 g in 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
return self._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-
for p in gl.Project():
638-
print p.name
639-
# get associated issues
640-
issues = p.Issue()
641-
for issue in issues:
642-
closed = 0 if not issue.closed else 1
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-
for g in gl.Group(page=1, per_page=10):
650-
print g

0 commit comments

Comments
 (0)