Ejemplo n.º 1
0
def request_rest_event_splunk(token, username, host, params, service_state, host_group, raw):
    if params == "":
        if not host_group or not service_state:
            print "you don't have startTime and host_group information for request"
            sys.exit()
        else:
            for each in ["ok", "warning", "critical", "unknown"]:
                if service_state == each:
                    params += "service_state=" + service_state + "&"
                else:
                    continue
            params += "host_group=" + str(host_group) + "&"
    else:
        pass

    params += "cols=state&cols=hostname&cols=time&cols=output"
    url = "https://" + host + "/rest/event?" + params + "&format_datetime=1"
    print "request url is", url
    if raw == 0:
        # get data from API as dictionary format
        dataFile = Ops.opsgetsend(url, user=username, key=token)
    elif raw == 1:
        # get data from API as json raw format
        dataFile = Ops.opsgetsend_rawjson(url, user=username, key=token)
        # print dataFile
    return dataFile
Ejemplo n.º 2
0
def request_rest_status_hostgroup(
    token,
    username,
    host,
    params="",
    hostgroupid="",
    fromhostgroupid="",
    servicecheck="",
    host_state=0,
    host_filter="unhandled",
    includeunhandledhosts="0",
    include_servicegroup="0",
    raw=0,
):
    if not username or not host:
        print "you have to input username in function request_rest_status_hostgroup"
        sys.exit()
    else:
        if hostgroupid == "":
            print "program don't get data by hostgroupid"
            params += "fromhostgroupid=" + str(fromhostgroupid) + "&"
        else:
            params += "hostgroupid=" + str(hostgroupid) + "&"
            if fromhostgroupid != "":
                print "program cannot get data from hostgroupid and fromhostgroupid , please chose only one"
                sys.exit()
        if servicecheck == "":
            print "program will get data by any servicecheck , if not please chose one"
        else:
            params += "servicecheck=" + str(servicecheck) + "&"
            print "program will get data by specific servicecheck :%s" % servicecheck
        if host_state == 0:
            print "default program will get data by any host_sate - 0:up , 1:down : %s" % host_state
        else:
            params += "host_state=" + str(host_state) + "&"
            print "program will get data by specific host_state :%s" % host_state
        if host_filter == "handled":
            print "program get data by %s host_filter" % host_filter
            params += "host_filter=" + host_filter + "&"
        else:
            pass
        if includeunhandledhosts == "0":
            print "program don't include host that are unhandled by request with specific services"
        elif include_servicegroup == "0":
            print "program don't include service group information"
            params += "includeunhandledhosts=" + str(1) + "&"
        else:
            params += "includeunhandledhosts=" + str(1) + "&" + "include_servicegroup=" + str(1)
    url = "https://" + host + "/rest/status/hostgroup?" + params
    print "request url is", url
    if raw == 0:
        # get data from API as dictionary format
        dataFile = Ops.opsgetsend(url, user=username, key=token)
    elif raw == 1:
        # get data from API as json raw format
        dataFile = Ops.opsgetsend_rawjson(url, user=username, key=token)
        # print dataFile
    return dataFile
def GetEventService(token, username, host, host_group, services=None, params="" ,service_state="ok,critical", state_type="hard", eventtype="0", raw=0):
    if not host_group or not service_state or not state_type or not token or not username or not host:
        print "you have to input service_state in function request_rest_event_splunk_service_state"
        sys.exit()
    else:
        host_group = host_group.split(",")
        if type(host_group) is StringType:
            params += "host_group=" + str(host_group) + "&"
        else:
            for each in host_group:
                params += "host_group=" + str(each) + "&"
        if services is not None:
            services = services.split(",")
            if type(services) is StringType:
                params += "service=" + str(services) + "&"
            else:
                for each in services:
                    params += "service=" + str(each) + "&"
        else:
            pass
        service_state = service_state.split(",")
        if type(service_state) is StringType:
            params += "service_state=" + str(service_state) + "&"
        else:
            for each in service_state:
                params += "service_state=" + str(each) + "&"
        state_type = state_type.split(",")
        if type(state_type) is StringType:
            params += "state_type=" + str(state_type) + "&"
        else:
            for each in state_type:
                params += "state_type=" + str(each) + "&"
        if eventtype is not "0":
            eventtype = eventtype.split(",")
            if type(eventtype)is StringType:
                params += "eventtype=" + str(eventtype) + "&"
            else:
                for each in list(eventtype):
                    params += "eventtype=" + str(each) + "&"
        else:
            params += "eventtype=" + str(eventtype) + "&"
    params += "cols=state&cols=hostname&cols=time&cols=output"
    url = "https://" + host + "/rest/event?" + params + "&format_datetime=1"
    logger.info("request url is: %s" % url)
    if raw == 0:
    # get data from API as dictionary format
        dataFile = Ops.opsgetsend(url, user=username, key=token)
    elif raw == 1:
    # get data from API as json raw format
        dataFile = Ops.opsgetsend_rawjson(url, user=username, key=token)
        #print dataFile
    if dataFile == None:
        return []
    else:
        return dataFile
Ejemplo n.º 4
0
def request_rest_event_splunk_all(token, username, host, params, raw):
    params += "cols=state&cols=hostname&cols=time&cols=output"
    url = "https://" + host + "/rest/event?" + params + "&format_datetime=1"
    print "request url is", url
    if raw == 0:
        # get data from API as dictionary format
        dataFile = Ops.opsgetsend(url, user=username, key=token)
    elif raw == 1:
        # get data from API as json raw format
        dataFile = Ops.opsgetsend_rawjson(url, user=username, key=token)
        # print dataFile
    return dataFile
Ejemplo n.º 5
0
def getHostIP(host, hostid, username, token):
    url = "https://" + host + "/rest/config/host/"+hostid
    print url
    dataFile = Ops.opsgetsend_rawjson(url=url, user=username, key=token)
    dataFile = json.loads(dataFile)
    print dataFile["object"]["ip"]
    return dataFile["object"]["ip"]
Ejemplo n.º 6
0
def request_rest_serverinfo(token, username, host, raw=0):
    if not username or not host:
        print "you have to input host_state in function request_rest_event_splunk_host_state"
        sys.exit()
    else:
        pass
    url = "https://" + host + "/rest/serverinfo"
    print "request url is", url
    if raw == 0:
    # get data from API as dictionary format
        dataFile = Ops.opsgetsend(url, user=username, key=token)
    elif raw == 1:
    # get data from API as json raw format
        dataFile = Ops.opsgetsend_rawjson(url, user=username, key=token)
        #print dataFile
    return dataFile
Ejemplo n.º 7
0
def request_rest_event_splunk_host_state(token, username, host, params, host_state, state_type, raw):
    if not host_state or not state_type:
        print "you have to input host_state in function request_rest_event_splunk_host_state"
        sys.exit()
    else:
        params += "host_state=" + host_state + "&" + "state_type=" + state_type + "&"
    params += "cols=state&cols=hostname&cols=time&cols=output"
    url = "https://" + host + "/rest/event?" + params + "&format_datetime=1"
    print "request url is", url
    if raw == 0:
        # get data from API as dictionary format
        dataFile = Ops.opsgetsend(url, user=username, key=token)
    elif raw == 1:
        # get data from API as json raw format
        dataFile = Ops.opsgetsend_rawjson(url, user=username, key=token)
        # print dataFile
    return dataFile
def GetAckStatusHost(token, username, host, host_group, params="", host_filter="unhandled,handled", host_state="0,1", state_type="0,1", raw=0):
    if not host_group or not token or not username or not host:
        logger.error("you have to input host_state in function request_rest_event_splunk_host_state")
        return []
    else:
        host_group = host_group.split(",")
        if type(host_group) is StringType:
            params += "hostgroupid=" + str(host_group) + "&"
        else:
            for each in host_group:
                params += "hostgroupid=" + str(each) + "&"  
        host_state = host_state.split(",")
        if type(host_state) is StringType:
            params += "host_state=" + str(host_state) + "&"
        else:
            for each in host_state:
                params += "host_state=" + str(each) + "&"
        
        state_type = state_type.split(",")
        if type(state_type) is StringType:
            params += "state_type=" + str(state_type) + "&"
        else:
            for each in state_type:
                params += "state_type=" + str(each) + "&"
        host_filter = host_filter.split(",")
        if type(host_filter) is StringType:
            params += "host_filter=" + str(host_filter) + "&"
        else:
            for each in host_filter:
                params += "host_filter=" + str(each) + "&"
    #params += "cols=state&cols=hostname&cols=time&cols=output" + "&"
    url = "https://" + host + "/rest/status/host?" + params + "format_datetime=1"
    logger.info("request url is: %s" % url )
    if raw == 0:
    # get data from API as dictionary format
        dataFile = Ops.opsgetsend(url, user=username, key=token)
    elif raw == 1:
    # get data from API as json raw format
        dataFile = Ops.opsgetsend_rawjson(url, user=username, key=token)
        #print dataFile
    if dataFile == None:
        return []
    else:
        return dataFile
Ejemplo n.º 9
0
def request_rest_event_opsview_hostgroup_hardstate(
    token, username, host, host_group, params="", host_state="down,up", state_type="hard", eventtype="0", raw=0
):
    if not host_group or not host_state or not state_type or not token or not username or not host:
        print "you have to input host_state in function request_rest_event_splunk_host_state"
        sys.exit()
    else:
        host_group = host_group.split(",")
        if type(host_group) is StringType:
            params += "host_group=" + str(host_group) + "&"
        else:
            for each in host_group:
                params += "host_group=" + str(each) + "&"
        host_state = host_state.split(",")
        if type(host_state) is StringType:
            params += "host_state=" + str(host_state) + "&"
        else:
            for each in host_state:
                params += "host_state=" + str(each) + "&"
        state_type = state_type.split(",")
        if type(state_type) is StringType:
            params += "state_type=" + str(state_type) + "&"
        else:
            for each in state_type:
                params += "state_type=" + str(each) + "&"
        if eventtype is not "0":
            eventtype = eventtype.split(",")
            if type(eventtype) is StringType:
                params += "eventtype=" + str(eventtype) + "&"
            else:
                for each in list(eventtype):
                    params += "eventtype=" + str(each) + "&"
    params += "cols=state&cols=hostname&cols=time&cols=output"
    url = "https://" + host + "/rest/event?" + params + "&format_datetime=1"
    print "request url is", url
    if raw == 0:
        # get data from API as dictionary format
        dataFile = Ops.opsgetsend(url, user=username, key=token)
    elif raw == 1:
        # get data from API as json raw format
        dataFile = Ops.opsgetsend_rawjson(url, user=username, key=token)
        # print dataFile
    return dataFile
Ejemplo n.º 10
0
 def opsview_delete_host(self, id=None):
     if id is not None:
         try:
             url = self.opsviewclient % (self.server, str(id))
             print url
             result = Ops.opsdeletesend(url, self.user, self.token)
             return result
         except:
             return False
     else:
         return False
Ejemplo n.º 11
0
def request_rest_status(token, username, host, hostgroupid, params, state="2,3", state_type=1, servicetype=0):
    reqservicetype = ""
    if params == "":
        if servicetype == 0:
            reqservicetype = "status/service"
            if not state and not hostgroupid:
                print "you don't have state and hostgroupid information for request"
                sys.exit()
            else:
                state = state.split(",")
                if type(state) is StringType:
                    params = "state=" + str(state) + "&" + "hostgroupid=" + str(hostgroupid)
                else:
                    for each in state:
                        params += "state=" + str(each) + "&"
                    params += "hostgroupid=" + str(hostgroupid) + "&" + "state_type=" + str(state_type)
        elif servicetype == 1:
            reqservicetype = "status/host"
            if not state and not hostgroupid:
                print "you don't have state and hostgroupid information for request"
                sys.exit()
            else:
                params = "state=" + str(state) + "&" + "hostgroupid=" + str(hostgroupid)
        elif servicetype == 2:
            reqservicetype = "status/hostgroup"
            if not state and not hostgroupid:
                print "you don't have state and hostgroupid information for request"
                sys.exit()
            else:
                params = "state=" + str(state) + "&" + "hostgroupid=" + str(hostgroupid)
        elif servicetype == 3:
            reqservicetype = "status/viewport"
            if not state and not hostgroupid:
                print "you don't have state and hostgroupid information for request"
                sys.exit()
            else:
                params = "state=" + str(state) + "&" + "hostgroupid=" + str(hostgroupid)
        elif servicetype == 4:
            reqservicetype = "status/performancemetric"
            if not state and not hostgroupid:
                print "you don't have state and hostgroupid information for request"
                sys.exit()
            else:
                params = "state=" + str(state) + "&" + "hostgroupid=" + str(hostgroupid)
        else:
            print "error params"
            sys.exit()
    else:
        pass
    url = "https://" + host + "/rest/" + reqservicetype + "?" + params + "&format_datetime=1"
    print "request url is", url
    dataFile = Ops.opsgetsend(url, user=username, key=token)
    # print dataFile
    return dataFile
Ejemplo n.º 12
0
def request_rest_event(token, username, host, host_group, eventtype, params="", service_state="critical", raw=0):
    if params == "":
        if not service_state or not host_group or not username:
            print "you don't have service_state and host_group information for request"
            sys.exit()
        else:
            pass
        host_group = host_group.split(",")
        if type(host_group) is StringType:
            params += "host_group=" + str(host_group) + "&"
        else:
            for each in host_group:
                params += "host_group=" + str(each) + "&"
        service_state = service_state.split(",")
        if type(service_state) is StringType:
            params += "service_state=" + service_state + "&"
        else:
            for each in service_state:
                params += "service_state=" + each + "&"
        eventtype = eventtype.split(",")
        if type(eventtype) is StringType:
            params += "eventtype=" + str(eventtype) + "&"
        else:
            for each in list(eventtype):
                params += "eventtype=" + str(each) + "&"
    else:
        pass
    params += "cols=state&cols=hostname&cols=time&cols=output&cols="
    url = "https://" + host + "/rest/event?" + params + "&format_datetime=1"
    print "request url is", url
    if raw == 0:
        # get data from API as dictionary format
        dataFile = Ops.opsgetsend(url, user=username, key=token)
    elif raw == 1:
        # get data from API as json raw format
        dataFile = Ops.opsgetsend_rawjson(url, user=username, key=token)
        # print dataFile
    return dataFile
Ejemplo n.º 13
0
 def opsview_search_host(self, hostgroup=None, hostname=None, hostip=None):
     if hostgroup is None and (hostname is None or hostip is None):
         return False
     else:
         # request get host match hostname or hostip input
         #try:
         if hostip is None:
             HOST_NAME = "%25"+hostname+"%25"
             url = self.url % se5lf.server + self.json_template_nonly % HOST_NAME
             print url
         elif hostname is None:
             HOST_IP = "%25"+hostip+"%25"
             url = self.url % self.server + self.json_template_iponly % HOST_IP
             print url
         else:
             HOST_NAME = "%25"+hostname+"%25"
             HOST_IP = "%25"+hostip+"%25"
             url = self.url % self.server + self.json_template % (HOST_NAME, HOST_IP)
             print url
             result = Ops.opsgetsend(url, self.user, self.token)
             return result
Ejemplo n.º 14
0
 def opsview_search_host(self, hostgroupid=None, hostname=None, hostip=None, condition="or"):
     '''
         if you define object include group variable is not None : function will digest on hostgroupid
         then return data of host under hostgroupid insert into function
             note: group is name of group is on test and not possible in this version of program
         if you define object not include group variable is None : function will digest as bellow
             - if exist hostname only : function digest data on opsviewclient match with hostname
             - if exist hostip only : function digest data on opsviewclient match with hostip
             - if exist hostname and hostip : function will digest data on condition variable : default is "or"
             you can change to "and" to change condition of search include both hostname and hostip for get results
             - if exist hostgroupid and hostname and hostip , only hostgroupid will use to get data
     '''
     # digest data with group exist in object class
     try:
         if self.group is not None:
             url = self.url % self.server
             if hostgroupid is not None:
                 GROUP_ID = "%25"+str(hostgroupid)+"%25"
                 url += self.json_template4 % GROUP_ID
             else:
                 GROUP_NAME = "%25"+self.group+"%25"
                 url += self.json_template4 % GROUP_NAME
             print url
             result = Ops.opsgetsend(url, self.user, self.token)
             return result
     # digest data with group not exist in object class
         # in case of you define hostgroupid to check
         if hostgroupid is not None:
             GROUP_ID = "%25"+str(hostgroupid)+"%25"
             url = self.url % self.server + self.json_template4 % GROUP_ID
             result = Ops.opsgetsend(url, self.user, self.token)
             return result
         #in case of hostgroupid is not exist and hostname and hostip still not exist - exit with False
         if hostname is None and hostip is None:
             return False
         #in case of hostgroupid is not exist and hostname and hostip both exist or particular exist
         #in case of hostname exist only
         if hostip is None:
             HOST_NAME = "%25"+hostname+"%25"
             url = self.url % self.server + self.json_template1 % HOST_NAME
             #url = self.url % self.server + self.json_template3 % hostname
             print url
             result = Ops.opsgetsend(url, self.user, self.token)
             return result
         #in case of hostip exist only
         elif hostname is None:
             HOST_IP = "%25"+hostip+"%25"
             url = self.url % self.server + self.json_template2 % HOST_IP
             print url
             result = Ops.opsgetsend(url, self.user, self.token)
             return result
         #in case of hostname and hostip both exist
         else:
             HOST_NAME = "%25"+hostname+"%25"
             HOST_IP = "%25"+hostip+"%25"
             url = self.url % self.server + self.json_template % (condition, HOST_NAME, HOST_IP)
             print url
             result = Ops.opsgetsend(url, self.user, self.token)
             return result
     except:
         return False
Ejemplo n.º 15
0
def request_rest_status(token, username, host, hostgroupid, params, state="2,3", state_type=1, servicetype=0):
    """
    URL: /rest/status/hostgroup

    GET - lists summarised information about host groups
    PUT, POST, DELETE - unimplemented
    URL parameters:

    hostgroupid - includes this host group in list. Can be repeated. Note, this is for this one host group id only
    parentid - includes all host groups with this parent. Can be repeated
    fromhostgroupid - will include all host groups from this point in the hierarchy 'downwards'. Includes itself.
    Can be repeated. Committed in trunk on 2012-09-24
    host - filter hosts by this host name. Can be repeated
    servicecheck - filter services by this service check name. Can be repeated
    filter - either handled or unhandled. Filters services by this condition
    host_filter - either handled or unhandled. Filters host by this condition
    state - filters by services in this state. Expects the numeric id for state. Can be repeated
    host_state - filters by hosts in this state. Expects the numeric id for state. Can be repeated
    includeunhandledhosts - if set to 1, will include hosts that are unhandled. Otherwise will only return services
    that are unhandled
    include_servicegroups - if set to 1, will include service group information, with number of ok, warning,critical
    and unknown states
    only_leaves - if set to 1, will only return host groups that are leaf host groups
    rows - returns this number of rows. Set to all to get all results. Defaults to all
    page - returns this page number if rows is set to a number. Defaults to 1st page
    cols - can specify columns to remove. Possible columns: leaf, matpath. Example: cols=-leaf,-matpath
    order - if set to dependency, will return order based on hierarchy, starting with the top first then depth first
    Otherwise, returns back ordered by name
    """
    reqservicetype = ""
    if params == "":
        if servicetype == 0:
            reqservicetype = "status/service"
            if not state and not hostgroupid:
                print "you don't have state and hostgroupid information for request"
                sys.exit()
            else:
                state = state.split(",")
                if type(state) is StringType:
                    params = "state="+str(state)+"&"+"hostgroupid="+str(hostgroupid)
                else:
                    for each in state:
                        params += "state="+str(each)+"&"
                    params += "hostgroupid="+str(hostgroupid)+"&"+"state_type="+str(state_type)
        elif servicetype == 1:
            reqservicetype = "status/host"
            if not state and not hostgroupid:
                print "you don't have state and hostgroupid information for request"
                sys.exit()
            else:
                params = "state="+str(state)+"&"+"hostgroupid="+str(hostgroupid)
        elif servicetype == 2:
            reqservicetype = "status/hostgroup"
            if not state and not hostgroupid:
                print "you don't have state and hostgroupid information for request"
                sys.exit()
            else:
                params = "state="+str(state)+"&"+"hostgroupid="+str(hostgroupid)
        elif servicetype == 3:
            reqservicetype = "status/viewport"
            if not state and not hostgroupid:
                print "you don't have state and hostgroupid information for request"
                sys.exit()
            else:
                params = "state="+str(state)+"&"+"hostgroupid="+str(hostgroupid)
        elif servicetype == 4:
            reqservicetype = "status/performancemetric"
            if not state and not hostgroupid:
                print "you don't have state and hostgroupid information for request"
                sys.exit()
            else:
                params = "state="+str(state)+"&"+"hostgroupid="+str(hostgroupid)
        else:
            print "error params"
            sys.exit()
    else:
        pass
    url = "https://"+host+"/rest/"+reqservicetype+"?"+params+"&format_datetime=1"
    print "request url is", url
    dataFile = Ops.opsgetsend(url, user=username, key=token)
    #print dataFile
    return dataFile
Ejemplo n.º 16
0
def request_rest_event_opsview_hostgroup_hardstate(token, username, host, host_group, params="", host_state="down,up", state_type="hard", eventtype="0", raw=0):
    """
    REST API: Event

    URL: /rest/event. This requires authentication. Requires VIEWALL or VIEWSOME permission

    GET - returns event data for requested objects
    POST, PUT, DELETE - not implemented
    An event is considered to be either:

    a host or service changing state (eg, from OK to CRITICAL)
    a host or service result during soft failures (eg, CRITICAL SOFT 1 to CRITICAL SOFT 2)
    a host or service in a failure state where alert every failure is enabled
    an acknowledgement
    a downtime start
    a downtime stop (or cancel)
    Note: The last three were added into trunk on 2012-06-18.

    Access Control

    VIEWALL allows all event data to be returned.

    VIEWSOME allows event data to be returned for objects where permission has been granted for the service based on
    the access object selection.

    Requesting Event Data

    Parameters:

    cols - defines which columns of data to return. Acceptable values: hostname, time, objectid, servicename, state,
    state_type, output, eventid, host_group, host_group_id, markdown_filter. Note that some columns will always be
    returned.
    For multiple columns use: cols=state&cols=hostname
    startTime - filter by start time, eg '2011-11-01 18:43:22'. Time is based on the server's timezone
    endTime - filter by end time
    rows - the number of rows to return
    page - which page of data to return
    sortby - a json structure to describe the ordering of results. Defaults to
    host_state - host states to filter on. Can be repeated. Acceptable values: up, down, unreachable
    service_state - service states to filter on. Can be repeated. Acceptable values: ok, warning, critical, unknown
    host - host names to filter on. Can be repeated
    service - service names to filter on. Can be repeated
    state_type - state type to filter on. Acceptable values: soft, hard
    host_group - host group to filter on. Can be anywhere in the hierarchy. Can be repeated
    keyword - keyword to filter on. Can be repeated
    search - search terms. Will search in host name, service name or output. Can be repeated to produce an AND effect
    saved_maxeventid - if set with the value of the last max event id, an extra attribute will be in the result to
    signify
    the number of new events since the last max event id (based on the filtering parameters)
    eventtype - there are 4 types of events: 0 = state change event; 1 = acknowledgements event; 2 = downtime start
    event;
    3 = downtime end event. If no eventtype is specified, only eventtype=0 is returned, otherwise specify multiple
    times to
    get different types added. This was committed into trunk 2012-06-18.
    """
    if not host_group or not host_state or not state_type or not token or not username or not host:
        print "you have to input host_state in function request_rest_event_splunk_host_state"
        sys.exit()
    else:
        host_group = host_group.split(",")
        if type(host_group) is StringType:
            params += "host_group=" + str(host_group) + "&"
        else:
            for each in host_group:
                params += "host_group=" + str(each) + "&"
        host_state = host_state.split(",")
        if type(host_state) is StringType:
            params += "host_state=" + str(host_state) + "&"
        else:
            for each in host_state:
                params += "host_state=" + str(each) + "&"
        state_type = state_type.split(",")
        if type(state_type) is StringType:
            params += "state_type=" + str(state_type) + "&"
        else:
            for each in state_type:
                params += "state_type=" + str(each) + "&"
        if eventtype is not "0":
            eventtype = eventtype.split(",")
            if type(eventtype)is StringType:
                params += "eventtype=" + str(eventtype) + "&"
            else:
                for each in list(eventtype):
                    params += "eventtype=" + str(each) + "&"
    params += "cols=state&cols=hostname&cols=time&cols=output"
    url = "https://" + host + "/rest/event?" + params + "&format_datetime=1"
    print "request url is", url
    if raw == 0:
    # get data from API as dictionary format
        dataFile = Ops.opsgetsend(url, user=username, key=token)
    elif raw == 1:
    # get data from API as json raw format
        dataFile = Ops.opsgetsend_rawjson(url, user=username, key=token)
        #print dataFile
    return dataFile