示例#1
0
def main():
    neonAccounts = {}

    #For real use, just get neon accounts directly
    #Be aware this takes a long time (2+ minutes)
    neonAccounts = neonUtil.getAllMembers()

    # Testing goes a lot faster if we're working with a cache of accounts
    # with open("Neon/memberAccounts.json") as neonFile:
    #     neonAccountJson = json.load(neonFile)
    #     for account in neonAccountJson:
    #         neonAccounts[neonAccountJson[account]["Account ID"]] = neonAccountJson[account]

    discourseUpdateHaxors(neonAccounts)
#Simple script to call neonUtil.getAllMembers() and write the results to disk

import neonUtil
import logging
import json

logging.basicConfig(level=logging.INFO)

#before doing all the Neon-fetching, make sure we can write our output file
#TODO filename should be a global config or command-line option or something
outfile = open('./Neon/memberAccounts.json', 'w')

neon_accounts = neonUtil.getAllMembers()

#write out to the file we opened up top
json.dump(neon_accounts, outfile, indent=4)