Developer Support Iotic Labs

Print Thing metadata

 

To print metadata about your Thing, add this section to your Thing script.

 

 

Python logo


def show_metadata(my_thing):
    print("METADATA (simplified)")

    # Get and print the metadata you set in the UI
    with my_thing.get_meta() as my_metadata:

        my_labels = my_metadata.get_labels()
        print("Labels:")
        print(my_labels)

        my_descriptions = my_metadata.get_descriptions()
        print("Descriptions:")
        print(my_descriptions)

        my_lat, my_lon = my_metadata.get_location()
        if my_lat is not None:
            print("Location lat = %f & lon = %f" % (my_lat, my_lon))
        else:
            print("No location set")

        print("Tags:")
        tag_list = my_thing.list_tag()
        print(tag_list)

 

You also need to add the following call to the MAIN section of your script.

 


show_metadata(my_thing)

 

 

Remember, before you can hook your Thing up to code you also need to:

 

  1. Create a new Iotic Agent in the Space app, and download an .ini file
  2. Assign Things to an Agent
  3. Organise your file directory

By continuing to use the site, you agree to the use of cookies. more information

This website uses cookies via Google Analytics to give you the best browsing experience possible. No personally-identifiable information is collected about you unless you explicitly submit that information on this website. Click "Accept" to continue.

Close