Project

General

Profile

Rest API with Python via pyactiveresource-1.0.1 - Null Values

Added by Kyle Gouck almost 13 years ago

Hello,

I am trying to develop an interface to redmine using the Rest API via pyactiveresource-1.0.1, but when I compare data received via the API and that which is available via issues.xml direct there are discrepances -

from pyactiveresource.activeresource import ActiveResource

class Issue(ActiveResource):
    _site = None

url = "http://1.1.1.1/redmine" 

Issue.set_site(url)

issues = Issue.find(None,None,limit=10,key="x")

for i, v in enumerate(issues):
    print 'issues [',i,']',' ='

    for item in issues[i].attributes:
       print item, " =  ", issues[i].attributes[item]

    print '======================'

Result -

==================================================================
issues [ 0 ] =
status = None
due_date = 2011-12-10
description = Test Project 3 Issue 1
project = None
author = None
id = 5
priority = None
created_on = 2011-11-26T23:20:06+00:00
tracker = None
done_ratio = 40
assigned_to = None
updated_on = 2011-11-26T23:20:06+00:00
estimated_hours = 5.0
start_date = 2011-11-26
category = None
subject = Test Project 3 Issue 1

==================================================================

Comparitive XML from querying issues.xml -

==================================================================
<issue>
<id>5</id>
<project name=*"Test Project 3"* id="3"/>
<tracker name="Bug" id="1"/>
<status name="Feedback" id="4"/>
<priority name*"Normal" id="4"/>
<author name="ME" id="3"/>
<assigned_to name="ME" id="3"/>
<category name="Admin" id="1"/>
<subject>Test Project 3 Issue 1</subject>
<description>Test Project 3 Issue 1</description>
<start_date>2011-11-26</start_date>
<due_date>2011-12-10</due_date>
<done_ratio>40</done_ratio>
<estimated_hours>5.0</estimated_hours>
<created_on>2011-11-26T23:20:06+00:00</created_on>
<updated_on>2011-11-26T23:20:06+00:00</updated_on>
</issue>

==================================================================

The only difference in the values that I get back and those that are 'None' is that they are wrapped differently in the XML. I have tried issues[i].attributes[item].name and other combinations to drill into the data but nothing seems to work.

Any advice on how I can get this additional info would be much apprecaited, the assigned_to field is particularly important.


Replies (1)

RE: Rest API with Python via pyactiveresource-1.0.1 - Null Values - Added by Hassan Nikaein over 12 years ago

hi Kyle
do you find any solution for this?

thanks.

    (1-1/1)