用户程序员指南有问题

时间:2015-04-08 08:58:13

标签: python linux fiware fiware-orion

我在this site做练习。在完成Context订阅之前,我已完全按照示例进行操作,没有任何问题:

(curl localhost:1026/v1/subscribeContext -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -d @- | python -mjson.tool) <<EOF
{
    "entities": [
        {
            "type": "Room",
            "isPattern": "false",
            "id": "Room1"
        }
    ],
    "attributes": [
        "temperature"
    ],
    "reference": "http://localhost:1028/accumulate",
    "duration": "P1M",
    "notifyConditions": [
        {
            "type": "ONTIMEINTERVAL",
            "condValues": [
                "PT10S"
            ]
        }
    ]
}
EOF

当我输入该代码时,我得到了预期的答案:

{
    "subscribeResponse": {
        "duration": "P1M",
        "subscriptionId": "51c04a21d714fb3b37d7d5a7"
    }
}

但是这句话让我困惑:

  

如果你看一下accumulator-script.py终端窗口,你会看到   每10个接收一个类似下一个消息的消息   秒:

我在这里做的是输入以下命令:python accumulator-server.py 但是我得到的输出(每10秒更新一次)是:127.0.0.1 - - [08/Apr/2015 10:52:56] "POST /accumulate HTTP/1.1" 200 -

我在这里遗漏了一些东西,因为我没有像教程中提到的那样得到预期的输出吗?

POST http://localhost:1028/accumulate
Content-Length: 492
User-Agent: orion/0.9.0
Host: localhost:1028
Accept: application/xml, application/json
Content-Type: application/json

{
  "subscriptionId" : "51c04a21d714fb3b37d7d5a7",
  "originator" : "localhost",
  "contextResponses" : [
    {
      "contextElement" : {
        "attributes" : [
          {
            "name" : "temperature",
            "type" : "float",
            "value" : "26.5"
          }
        ],
        "type" : "Room",
        "isPattern" : "false",
        "id" : "Room1"
      },
      "statusCode" : {
        "code" : "200",
        "reasonPhrase" : "OK"
      }
    }
  ]
}

我没有正确运行python脚本或?顺便说一句,我对python和linux都很陌生......

1 个答案:

答案 0 :(得分:1)

根据the manual,运行累加器的方法如下:

./accumulator-server.py 1028 /accumulate ::1 on