def __init__(self): """ An instance of Nodelist contains a list of registered VAMDC nodes. This list is retrieved via querying the VAMDC registry by default during initialization of the instance. """ self.nodes = [] for node in getNodeList(): self.nodes.append(Node(node['name'], url=node['url'], identifier = node['identifier'], email=node['maintainer']))
def run(): nodes = getNodeList() jobs = [gevent.spawn(headreq, node) for node in nodes] gevent.joinall(jobs, timeout=TIMEOUT + 1) results = [job.value for job in jobs if job.value] for result in results: if result.status_code != 200: continue print '\n', result.url for head in result.headers: if head.lower().startswith('vamdc'): print head, result.headers[head]
def run(): nodes = getNodeList() jobs = [gevent.spawn(headreq, node) for node in nodes] gevent.joinall(jobs, timeout=TIMEOUT + 1) results = [job.value for job in jobs if job.value] for result in results: if result.status_code != 200: continue print "\n", result.url for head in result.headers: if head.lower().startswith("vamdc"): print head, result.headers[head]
#!/usr/bin/env python import sys import requests from registry import getNodeList TIMEOUT = 5 QUERY = sys.argv[1] PARAMS = {'QUERY':QUERY, 'FORMAT':'XSAMS', 'LANG':'VSS2'} nodes = getNodeList() for node in nodes: result = requests.head(node['url']+'sync', params=PARAMS,timeout=TIMEOUT) if result.status_code != 200: continue print '\n*%s*'%node['name'] for head in result.headers: if head.lower().startswith('vamdc'): print '%s: %s'%(head, result.headers[head]) print result.url
#!/usr/bin/env python import sys import requests from registry import getNodeList TIMEOUT = 5 QUERY = sys.argv[1] PARAMS = {'QUERY': QUERY, 'FORMAT': 'XSAMS', 'LANG': 'VSS2'} nodes = getNodeList() for node in nodes: result = requests.head(node['url'] + 'sync', params=PARAMS, timeout=TIMEOUT) if result.status_code != 200: continue print '\n*%s*' % node['name'] for head in result.headers: if head.lower().startswith('vamdc'): print '%s: %s' % (head, result.headers[head]) print result.url
# -*- coding: utf-8 -*- from django.shortcuts import render_to_response,get_object_or_404 from django.template import RequestContext from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from django import forms from django.forms.formsets import formset_factory from models import Query import registry try: REGISTRY = registry.getNodeList() except: REGISTRY = [{'name':'Registry is down','url':None}] import string as s from random import choice def makeQID(length=6, chars=s.letters + s.digits): return ''.join([choice(chars) for i in xrange(length)]) from urllib import urlopen,urlencode PARA_CHOICES=[('',u'----'), ('AtomSymbol',u'Atom Name'), ('AtomNuclearCharge',u'Atomic number'), ('AtomIonCharge',u'Ionization state (0=neutral)'), ('AtomStateEnergy',u'Atomic state energy (eV)'), ('',u'----'), ('RadTransWavelengthExperimentalValue',u'(Radiative transition) Wavelength (Å)'), ('RadTransProbabilityLog10WeightedOscillatorStrengthValue',u'(Radiative transition) Oscillator strength, log(g*f)'), ('',u'----'), ('MolecularSpeciesChemicalName',u'Molecule Name'),