<commit_before>agolTools
=========

A Python package to assist with administering ArcGIS Online Organizations.

## Sample usage
 
#### Create a spreadsheet of all users in the org
	import csv
    from agolTools import admin
    myAgol = admin.admin()
    users = myAgol.getUsers()

    outputDir = 'c:/temp'
    outputFile = outputDir + '/users.csv'

    with open(outputFile, 'wb') as outputFile:
        dataWriter = csv.writer(outputFile, delimiter=',',
                                quotechar='|', quoting=csv.QUOTE_MINIMAL)
        # Write header row.
        dataWriter.writerow(['Full Name', 'Username', 'Role'])
        #Write user data.
        for user in users:
            dataWriter.writerow([user['fullName'], user['username'], user['role']])<commit_msg>added installation instructions and new samples<commit_after>agolTools
=========

A Python package to assist with administering ArcGIS Online Organizations.

#### Installation
Unzip into a folder such as C:/myscripts, then either:

* add that directory to your system path in advanced system settings
* append it at runtime using the sys module in python
    
    `import sys`
    
    `sys.path.append('c:/myscripts')`

    
## Sample usage

### Admin Class
 
#### Create a spreadsheet of all users in the org
	import csv
    from agolTools.admin import Admin
    agolAdmin = Admin(<username>)
    users = agolAdmin.getUsers()

    outputDir = 'c:/temp'
    outputFile = outputDir + '/users.csv'

    with open(outputFile, 'wb') as outputFile:
        dataWriter = csv.writer(outputFile, delimiter=',',
                                quotechar='|', quoting=csv.QUOTE_MINIMAL)
        # Write header row.
        dataWriter.writerow(['Full Name', 'Username', 'Role'])
        #Write user data.
        for user in users:
            dataWriter.writerow([user['fullName'], user['username'], user['role']])

            
### Utilities Class
            
#### Update map service urls in webmaps
    from agolTools.utilities import Utilities
    myAgolUtilities = Utilities(<username>)

    webmapId = 'e1d78110b0eg447aab46d373c7360046'
    oldUrl = 'http://myserver.com/arcgis/rest/services/old/MapServer'
    newUrl = 'http://myserver.com/arcgis/rest/services/new/MapServer'

    myAgolUtilities.updateWebmapService(webmapId, oldUrl, newUrl)
{'fraction_non_alphanumeric': 0.11601731601731602, 'fraction_numerical': 0.009523809523809525, 'mean_word_length': 3.0121527777777777, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6901459', 'n_tokens_mistral': 699, 'n_tokens_neox': 657, 'n_words': 191}