MCPcopy Index your code
hub / github.com/algorithmiaio/algorithmia-python / set_secret

Method set_secret

Algorithmia/algorithm.py:58–79  ·  view source on GitHub ↗
(self, short_name, secret_key, secret_value, description=None)

Source from the content-addressed store, hash-verified

56
57
58 def set_secret(self, short_name, secret_key, secret_value, description=None):
59 algorithm_id = self.get_algorithm_id()
60 url = "/v1/algorithms/" + algorithm_id + "/secrets"
61 secret_providers = self.client.get_secret_providers()
62 provider_id = secret_providers[0]['id']
63
64 create_parameters = {
65 "owner_type": "algorithm",
66 "owner_id": algorithm_id,
67 "short_name": short_name,
68 "provider_id": provider_id,
69 "secret_key": secret_key,
70 "secret_value": secret_value,
71 }
72 if description:
73 create_parameters['description'] = description
74 else:
75 create_parameters['description'] = " "
76
77 print(create_parameters)
78 api_response = self.client.postJsonHelper(url, create_parameters, parse_response_as_json=True)
79 return api_response
80
81
82 # Create a new algorithm

Callers 1

test_set_secretMethod · 0.80

Calls 3

get_algorithm_idMethod · 0.95
get_secret_providersMethod · 0.80
postJsonHelperMethod · 0.80

Tested by 1

test_set_secretMethod · 0.64