Commits

Anonymous committed e4d5289

Added the OCC eods fetch utility.

  • Participants
  • Parent commits ff3f0c6

Comments (0)

Files changed (3)

File eodsfetch/eodsfetch.bat

+@echo off
+
+rem This batch file demonstrates some of the options for eodsfetch.exe
+rem To see all of the options available, run eodsfetch --help
+
+rem C:\Users\jaraco\projects\hrworx-util\dist>eodsfetch --help
+rem Usage: eodsfetch [options]
+rem
+rem Options:
+rem   -h, --help            show this help message and exit
+rem   -u URL, --url=URL     URL for the admin site
+rem   -n USERNAME, --username=USERNAME
+rem                         Username with export priveleges
+rem   -p PASSWORD, --password=PASSWORD
+rem                         Password
+rem   -l LOG_LEVEL, --log-level=LOG_LEVEL
+rem                         level should be DEBUG, INFO, WARNING, ERROR
+rem   -c RETRIEVE_COMMAND, --retrieve-command=RETRIEVE_COMMAND
+rem                         Web site path to retrieval command
+rem   -s SAVE_FILE, --save-file=SAVE_FILE
+rem                         filename to save data
+
+rem To retrieve data from the dev01 demonstration site, use the following command:
+rem eodsfetch.exe -u http://dev01.hrworx.com:8180/occ/formworx/admin -n occ.formworx@hrworx.com -p manager -c /newhires/RetrieveQueuedExport.do -s c:\EODS.xml
+
+rem To review the data (without purging the records), use the "Review" command:
+rem eodsfetch.exe -u http://dev01.hrworx.com:8180/occ/formworx/admin -n occ.formworx@hrworx.com -p manager -c /newhires/ReviewQueuedExport.do -s c:\EODS.xml
+
+rem If you don't specify a file to save to, the XML will be output to the screen
+rem eodsfetch.exe -u http://dev01.hrworx.com:8180/occ/formworx/admin -n occ.formworx@hrworx.com -p manager -c /newhires/ReviewQueuedExport.do

File eodsfetch/eodsfetch.py

+import urllib2, sys
+from ClientForm import ParseResponse
+from optparse import OptionParser
+
+def getArgs( ):
+	parser = OptionParser()
+	parser.add_option( "-u", "--url", dest="url", default="http://dev01.hrworx.com:8180/occ/formworx/admin/", help="URL for the admin site" )
+	parser.add_option( "-n", "--username", default="admin", dest="username", help="Username with export priveleges" )
+	parser.add_option( "-p", "--password", default="pa55word", dest="password", help="Password" )
+	parser.add_option( "-l", "--log-level", dest="log_level", default="info", help="level should be DEBUG, INFO, WARNING, ERROR" )
+	parser.add_option( "-c", "--retrieve-command", default="/newhires/ReviewQueuedExport.do", help="Web site path to retrieval command" )
+	parser.add_option( "-s", "--save-file", help="filename to save data" )
+	return parser.parse_args()
+
+def main():
+	global options
+	options, args = getArgs()
+	opener = urllib2.build_opener(urllib2.HTTPCookieProcessor)
+	urllib2.install_opener( opener )
+	login_page = urllib2.urlopen( options.url )
+	login_form = ParseResponse( login_page, backwards_compat=False )[0]
+	login_form['userName'] = options.username
+	login_form['password'] = options.password
+	urllib2.urlopen(login_form.click()).read()
+	result = urllib2.urlopen( options.url + options.retrieve_command ).read()
+	try:
+		output = open( options.save_file, 'w' )
+	except TypeError:
+		output = sys.stdout
+	output.write( result )
+
+if __name__ == '__main__':
+	main()

File eodsfetch/setup-eodsfetch.py

+from distutils.core import setup
+import py2exe
+
+setup( console=['eodsfetch.py'],
+       script_args=('py2exe',),
+       data_files=[('.',['eodsfetch.bat'])]
+       )