How to use the fastly.models.DictionaryItem.upsert function in fastly

To help you get started, we’ve selected a few fastly examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fastly / fastly-py / fastly / models.py View on Github external
def item(self, item_key, item_value=None):
        if item_value is not None:
            return DictionaryItem.upsert(self.conn, {
                'service_id': self.attrs['service_id'],
                'dictionary_id': self.attrs['id'],
                'item_key': item_key,
                'item_value': item_value,
            })
        return DictionaryItem.find(self.conn, service_id=self.attrs['service_id'], dictionary_id=self.attrs['id'], item_key=item_key)