Skip to content

Instantly share code, notes, and snippets.

@coxley
Forked from jathanism/nsot_bulk_update.py
Created October 22, 2015 05:09
Show Gist options
  • Save coxley/60c79245d65fc936a011 to your computer and use it in GitHub Desktop.
Save coxley/60c79245d65fc936a011 to your computer and use it in GitHub Desktop.
import copy
from pynsot.client import get_api_client()
api = get_api_client()
site = api.sites(api.default_site)
objects = site.networks.get(network_address='192.168.0.0')['data']['networks']
to_update = copy.deepcopy(objects)
[t['attributes'] = {} for t in to_update] # Strip the attributes
result = site.networks.put(to_update)
# result will be a list of the updated objects and be a 200 OK response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment