Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-15567

[fiware-stackoverflow] Accessing Orion CB with python script

    Details

      Description

      Created question in FIWARE Q/A platform on 13-03-2019 at 13:03
      Please, ANSWER this question AT https://stackoverflow.com/questions/55142367/accessing-orion-cb-with-python-script

      Question:
      Accessing Orion CB with python script

      Description:
      Would like to access orion data using a python script (not using curlor Postmann. Below show the python script in my orion.pyscript:

      import json
      import requests

      orion_endpoint="some-endpoint"

      url_query=("orion_url" % (orion_endpoint))
      body_dict = {
      'entities': [

      { 'type': 'AirQualityObserved', 'idPattern': '.*', }

      ],

      }

      r_headers =

      {'Content-Type': 'application/json'}

      #print(data["coordinates"][0][0])
      r = requests.post(
      url=url_query,
      data=json.dumps(body_dict),
      headers=r_headers
      )

      print(r.content)

      Running this script dumps the entity information to the console. How do I use the script to subscribe for notification so I get notified (not just dumping context)?

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        18h 1 Backlog Manager 14/Mar/19 9:06 AM
        In Progress In Progress Answered Answered
        8h 59m 1 Backlog Manager 14/Mar/19 6:06 PM
        Answered Answered Closed Closed
        2h 59m 1 Backlog Manager 14/Mar/19 9:06 PM
        fla Fernando Lopez made changes -
        Fix Version/s 2021 [ 12600 ]
        Hide
        backlogmanager Backlog Manager added a comment -

        2019-03-14 21:05|UPDATED status: transition Finish| # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2019-03-14 21:05|UPDATED status: transition Finish| # answers= 1, accepted answer= True
        backlogmanager Backlog Manager made changes -
        Resolution Done [ 10000 ]
        Status Answered [ 10104 ] Closed [ 6 ]
        Hide
        backlogmanager Backlog Manager added a comment -

        2019-03-14 18:06|UPDATED status: transition Answered| # answers= 1, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2019-03-14 18:06|UPDATED status: transition Answered| # answers= 1, accepted answer= False
        backlogmanager Backlog Manager made changes -
        Status In Progress [ 3 ] Answered [ 10104 ]
        Hide
        backlogmanager Backlog Manager added a comment -

        2019-03-14 09:06|UPDATED status: transition Answer| # answers= 1, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2019-03-14 09:06|UPDATED status: transition Answer| # answers= 1, accepted answer= False
        backlogmanager Backlog Manager made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        fla Fernando Lopez made changes -
        HD-Enabler Orion [ 10875 ]
        Description
        Created question in FIWARE Q/A platform on 13-03-2019 at 13:03
        {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/55142367/accessing-orion-cb-with-python-script


        +Question:+
        Accessing Orion CB with python script

        +Description:+
        Would like to access orion data using a python script (not using curlor Postmann. Below show the python script in my orion.pyscript:

        import json
        import requests

        orion_endpoint="some-endpoint"

        url_query=("orion_url" % (orion_endpoint))
        body_dict = {
          'entities': [
            {
              'type': 'AirQualityObserved',
              'idPattern': '.*',
            }
          ],

        }

        r_headers = {'Content-Type': 'application/json'}
        #print(data["coordinates"][0][0])
        r = requests.post(
            url=url_query,
            data=json.dumps(body_dict),
            headers=r_headers
        )

        print(r.content)


        Running this script dumps the entity information to the console. How do I use the script to subscribe for notification so I get notified (not just dumping context)?
        Created question in FIWARE Q/A platform on 13-03-2019 at 13:03
        {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/55142367/accessing-orion-cb-with-python-script


        +Question:+
        Accessing Orion CB with python script

        +Description:+
        Would like to access orion data using a python script (not using curlor Postmann. Below show the python script in my orion.pyscript:

        import json
        import requests

        orion_endpoint="some-endpoint"

        url_query=("orion_url" % (orion_endpoint))
        body_dict = {
          'entities': [
            {
              'type': 'AirQualityObserved',
              'idPattern': '.*',
            }
          ],

        }

        r_headers = {'Content-Type': 'application/json'}
        #print(data["coordinates"][0][0])
        r = requests.post(
            url=url_query,
            data=json.dumps(body_dict),
            headers=r_headers
        )

        print(r.content)


        Running this script dumps the entity information to the console. How do I use the script to subscribe for notification so I get notified (not just dumping context)?
        fla Fernando Lopez made changes -
        Assignee Jose Manuel Cantera [ jmcantera ]
        backlogmanager Backlog Manager made changes -
        Field Original Value New Value
        Component/s FIWARE-TECH-HELP [ 10278 ]
        Hide
        backlogmanager Backlog Manager added a comment -

        2019-03-13 15:05|CREATED monitor | # answers= 0, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2019-03-13 15:05|CREATED monitor | # answers= 0, accepted answer= False
        backlogmanager Backlog Manager created issue -

          People

          • Assignee:
            jmcantera Jose Manuel Cantera
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: