Rest api with python » 履歴 » バージョン 1
Mitsuyoshi Yoshida, 2011/11/13 12:43
1 | 1 | Mitsuyoshi Yoshida | redmine.org の "Rest_api_with_python":http://www.redmine.org/projects/redmine/wiki/Rest_api_with_python の日本語訳です。 |
---|---|---|---|
2 | |||
3 | h1. Python での REST API の使用法 |
||
4 | |||
5 | |||
6 | Python で REST API を使用する場合、よく知られている方法は以下の 2 つです。 |
||
7 | |||
8 | # "PyActiveResource":http://code.google.com/p/pyactiveresource/ |
||
9 | # "Python library":http://code.google.com/p/pyredminews/ |
||
10 | |||
11 | |||
12 | h2. *PyActiveResource* の例 |
||
13 | |||
14 | <pre> |
||
15 | <code class="python"> |
||
16 | # pyactiveresource のインポート |
||
17 | from pyactiveresource.activeresource import ActiveResource |
||
18 | |||
19 | class Issue(ActiveResource): |
||
20 | _site = 'http://redmine.foo.org' |
||
21 | _user = 'username' |
||
22 | _password = 'password' |
||
23 | |||
24 | # チケットの取得 |
||
25 | issues = Issue.find() |
||
26 | |||
27 | # ID で指定したチケットの取得 |
||
28 | issue = Issue.find(1345) |
||
29 | |||
30 | # チケットの属性 |
||
31 | |||
32 | # 属性の更新 |
||
33 | |||
34 | </pre> |