VersionOne.SDK.Python创建故事时的异常

时间:2015-05-11 10:51:33

标签: python versionone

当我从python控制台调用Create API时,它会给出以下异常。

Traceback (most recent call last):
File "<stdin>", line 3, in <module>
  File "C:\Python27\lib\v1pysdk\base_asset.py", line 44, in create
    return Class._v1_v1meta.create_asset(Class._v1_asset_type_name, newdata)
  File "C:\Python27\lib\v1pysdk\v1meta.py", line 128, in create_asset
    new_asset_xml = self.server.create_asset(asset_type_name,  update_doc)
  File "C:\Python27\lib\v1pysdk\client.py", line 202, in create_asset
    return self.get_xml(path, query=query, postdata=body)
  File "C:\Python27\lib\v1pysdk\client.py", line 159, in get_xml
    document = ElementTree.fromstring(body)
  File "C:\Python27\lib\xml\etree\ElementTree.py", line 1281, in XML
    parser.feed(text)
  File "C:\Python27\lib\xml\etree\ElementTree.py", line 1623, in feed
    self._raiseerror(v)
  File "C:\Python27\lib\xml\etree\ElementTree.py", line 1487, in _raiseerror
    raise err
xml.etree.ElementTree.ParseError: reference to invalid character number: line 7575, column 75

我在Windows上使用Python2.7运行它。 这是我正在调用的API

from v1pysdk import V1Meta

v1 = V1Meta(
     address = 'www11.v1host.com',
     instance = '<InstName>',
     username = 'sbaid',
     password = 'XXXXXX'
     )

new_story = v1.Story.create(
    Name = "Temp",
    Scope = v1.Scope(321450)
    )

v1.Scope(321450)返回正确的项目名称,这意味着正确建立了与版本1的会话。

这是唯一的两个必修参数,我可以使用Web界面使用这两个参数创建故事。

我也可以使用以下REST请求创建故事

网址 - https://www11.v1host.com/InstName/rest-1.v1/Data/Story

<Asset href="/<InstName>/rest-1.v1/New/Story">
<Attribute name="Name" act="set">Temp</Attribute>
<Relation name="Scope" act="set">
<Asset href="/<InstName>/rest-1.v1/Data/Scope/321450" idref="Scope:321450" />
</Relation>
</Asset>

1 个答案:

答案 0 :(得分:1)

有另一种方法可以指定更可靠的主机地址。以下是您可以尝试对抗公共VersionOne SDK测试实例的示例:

TypeError: $(...).datetimepicker is not a function
$('#datetimepicker1').datetimepicker();