PUT 不更新 Pipedrive API(Python 包装器)

PUT not updating Pipedrive API (Python wrapper)

以下是我正在尝试做的事情的简要说明:

我正在使用在这里找到的一个很好的包装器:https://github.com/hiway/pipedrive-api

这是我的代码:

from pipedrive import Pipedrive
pd = Pipedrive('API_token')
                   # ^ insert API token                  
EAAR = pd.deals.get(id=693)       ## parse info from given deal/field
Current_value = float(EAAR.value) ## convert value to decimal
print 'Previous value was ', Current_value

New_value = Current_value * 0.96
print 'New Value is ', New_value

pd.deals.put({
    id:693,
    'value': New_value})

EAAR2 = pd.deals.get(id=693)
print EAAR2.value

因此预期输出为:

>>>Previous value was  5.0
>>>New Value is  4.8
>>>4.8

但是,我得到:

>>>Previous value was  5.0
>>>New Value is  4.8
>>>5

如有任何想法,我们将不胜感激!

你的 put 可能失败了。在 id:

两边加上引号

pd.deals.put({ 'id':693, 'value': New_value})

当然是语法问题,经过大量调试才发现。新代码现在如下所示:

pd.deals.put(
    id=693,
    data={
    "value":New_value})

通过将交易 ID 移到数据字段之外来反映更改。