Esempio n. 1
0
def main():
    # think about this - pits it into separate xls files
    some_config = Config()
    ot = orgtools(securityinfo=some_config.agolconfig)
    for item in ot.getGroupContent(some_config.assetgroupname):

        UpdateFactory.reportfactory(item).do_reporting()
    securityinfo['proxy_url'] = proxy_url
    securityinfo['proxy_port'] = proxy_port
    securityinfo['referer_url'] = None
    securityinfo['token_url'] = None
    securityinfo['certificatefile'] = None
    securityinfo['keyfile'] = None
    securityinfo['client_id'] = None
    securityinfo['secret_id'] = None

    groups = ["Demographic Content"]  #Name of groups
    outputlocation = r"C:\TEMP"
    outputfilename = "group.json"
    outputitemID = "id.csv"
    try:

        orgt = orgtools.orgtools(securityinfo)

        groupRes = []
        if orgt.valid:
            fileName = os.path.join(outputlocation, outputfilename)
            csvFile = os.path.join(outputlocation, outputitemID)
            iconPath = os.path.join(outputlocation, "icons")
            if not os.path.exists(iconPath):
                os.makedirs(iconPath)
            file = open(fileName, "w")
            with open(csvFile, 'wb') as csvfile:
                idwriter = csv.writer(csvfile,
                                      delimiter=',',
                                      quotechar='|',
                                      quoting=csv.QUOTE_MINIMAL)
                for groupName in groups:
    # Get Python syntax error
    #
    synerror = traceback.format_exc().splitlines()[-1]
    return line, filename, synerror

if __name__ == "__main__":
    username = "******"
    password = "******"
    url = "<portal or AGOL url>"
    csvgroups = "<path to csv file>"
    pathtoicons = "<path to icons folder>"
      
    try:

            orgt = orgtools.orgtools(username = username, password=password,org_url=url,
                                               token_url=None, 
                                               proxy_url=None, 
                                               proxy_port=None)
            
                   
            if orgt.valid:
                        
                if os.path.isfile(csvgroups):
                    with open(csvgroups, 'rb') as csvfile:
    
                        for row in csv.DictReader(csvfile,dialect='excel'):
                            if os.path.isfile(os.path.join(pathtoicons,row['thumbnail'])):
                                thumbnail = os.path.join(pathtoicons,row['thumbnail'])
                                if not os.path.isabs(thumbnail):
    
                                    sciptPath = os.getcwd()
                                    thumbnail = os.path.join(sciptPath,thumbnail)
Esempio n. 4
0
    securityinfo["proxy_url"] = proxy_url
    securityinfo["proxy_port"] = proxy_port
    securityinfo["referer_url"] = None
    securityinfo["token_url"] = None
    securityinfo["certificatefile"] = None
    securityinfo["keyfile"] = None
    securityinfo["client_id"] = None
    securityinfo["secret_id"] = None

    groups = ["Demographic Content"]  # Name of groups
    outputlocation = r"C:\TEMP"
    outputfilename = "group.json"
    outputitemID = "id.csv"
    try:

        orgt = orgtools.orgtools(securityinfo)

        groupRes = []
        if orgt.valid:
            fileName = os.path.join(outputlocation, outputfilename)
            csvFile = os.path.join(outputlocation, outputitemID)
            iconPath = os.path.join(outputlocation, "icons")
            if not os.path.exists(iconPath):
                os.makedirs(iconPath)
            file = open(fileName, "w")
            with open(csvFile, "wb") as csvfile:
                idwriter = csv.writer(csvfile, delimiter=",", quotechar="|", quoting=csv.QUOTE_MINIMAL)
                for groupName in groups:
                    results = orgt.getGroupContent(groupName=groupName, onlyInOrg=True, onlyInUser=True)

                    if not results is None:
Esempio n. 5
0
    synerror = traceback.format_exc().splitlines()[-1]
    return line, filename, synerror


if __name__ == "__main__":
    username = "******"
    password = "******"
    url = "<portal or AGOL url>"
    csvgroups = "<path to csv file>"
    pathtoicons = "<path to icons folder>"

    try:

        orgt = orgtools.orgtools(username=username,
                                 password=password,
                                 org_url=url,
                                 token_url=None,
                                 proxy_url=None,
                                 proxy_port=None)

        if orgt.valid:

            if os.path.isfile(csvgroups):
                with open(csvgroups, 'rb') as csvfile:

                    for row in csv.DictReader(csvfile, dialect='excel'):
                        if os.path.isfile(
                                os.path.join(pathtoicons, row['thumbnail'])):
                            thumbnail = os.path.join(pathtoicons,
                                                     row['thumbnail'])
                            if not os.path.isabs(thumbnail):
Esempio n. 6
0
 def execute_update_areas_process(self):
     ot = orgtools(securityinfo=self._config.agolconfig)
     for item in ot.getGroupContent(self._config.assetgroupname):
         UpdateFactory.factory(item).update_areas_for_features()