Project

General

Profile

Rest api ẅith python » History » Version 7

Javier Hernandez, 2010-11-09 10:15

1 4 Javier Hernandez
h1. Using the REST API with Python
2
3 6 Javier Hernandez
Here is the two well-known options for using REST API with python. 
4 4 Javier Hernandez
5 5 Javier Hernandez
 # "PyActiveResource":http://code.google.com/p/pyactiveresource/
6 1 Javier Hernandez
 # "Python library":http://code.google.com/p/pyredminews/
7 6 Javier Hernandez
8
9
h2. *PyActiveResource* example:
10
11 7 Javier Hernandez
<pre>
12
<code class="python">
13 6 Javier Hernandez
# Importing pyactiveresource
14
from pyactiveresource.activeresource import ActiveResource
15
16
class Issue(ActiveResource):
17
    _site = 'http://redmine.foo.org'
18
    _user = 'username'
19
    _password = 'password'
20
21
# Get issues
22
issues = Issue.find()
23
24
# Get a specific issue, from its id
25
issue = Issue.find(1345)
26
27
# Issue attributes
28
29
# Updating an attribute
30
31
</pre>