Skip to content

@dave5 /gist:1629913
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Get Nodes - Python
def get_manufacturing_nodes(URL, keydata, verbose=True):
""" Get the nodes from dedicated url.
Uses basic request
"""
URL_full = "%s%s?%s" % (URL, nodesTAG, keydata)
if verbose:
print "Getting Node catalog\n %s" % (URL_full)
req = Request(URL_full)
success, result = basic_request(req)
if not success:
# fail!!
if verbose: print "Error:", result
return (False, result)
else: # Success
nodes = json.loads(result[0])['nodes']
if verbose:
print "Response:\n %s" % (nodes)
# for each node
for i in range(len(nodes)):
print "Node name", nodes[i][u'name']
print " Last updated:", nodes[i][u'materials_updated_at']
print " node_key", nodes[i][u'key']
return (True, nodes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.