def init_thing_with_boto()

in iot_client.py [0:0]


    def init_thing_with_boto(self):
        boto_iot_client = boto3.client('iot')
        print("Retrieving certificate")
        certificate_data = boto_iot_client.create_certificate_from_csr(
            certificateSigningRequest=self.csr.decode('utf-8'),
            setAsActive=True
        )
        print(certificate_data['certificatePem'].splitlines())

        f = open("iot_provisioning_template.json", "r")
        provisioning_template_string = f.read()
        prov_template_object = json.loads(provisioning_template_string)
        prov_template_object['Resources']['policy']['Properties']['PolicyName'] = os.environ['IOT_POLICY_NAME']
        boto_iot_client.register_thing(
            templateBody=json.dumps(prov_template_object),
            parameters={
                "ThingName": self.thing_name,
                "AWS::IoT::Certificate::Id": certificate_data['certificateId']
            }
        )
        return certificate_data['certificatePem']