Exception handling

The Python SDK contains the py1010.TentenException class.

The py1010.TentenException class can be caught with try/except. The py1010.TentenException is the parent class of all of the 1010data Python exceptions. In this example, the application employs try/except with the py1010.TentenException.

import py1010
import sys

gateway = "https://www2.1010data.com/cgi-bin/gw"
tablename = "pub.demo.weather.stations"
username = "[USER_NAME]"
password = "[PASSWORD]"

    with py1010.Session(gateway, username, password, py1010.POSSESS) as session:
        query = session.query(tablename, '<sel value="(elev>10)"/>')
        for r in query.rows:
            print("\t".join([str(x) for x in r]))
except py1010.TentenException as e:
    print("Error: {}".format(e))
Note: [USER_NAME] and [PASSWORD] are placeholders for valid Insights Platform user name and password.