Exemple #1
0
def do_get_teamrooms(api, save_xml):
    if save_xml: save_xml='get_teamrooms'
    all_rooms = get_teamrooms(api, save_xml=save_xml)
    for n in range(len(all_rooms)):
        room = all_rooms[n]
        hdr = '------ room {0:2d} ------\n'.format(n+1)
        stdout(hdr)
        print_dict(stdout, room)
        stdout('\n')
    api.clean_exit(0)
Exemple #2
0
         subcategory, title, visibility"

         Default is to return all of the above.
"""
(pgm, ext) = path.splitext(path.basename(sys.argv[0]))
(api, argv) = app_main(pgm, sys.argv[1:], usage)
(popts, args) = parse_request(pgm, argv, usage)
if popts is None: api.clean_exit(1)
if not args or not len(args) == 2:
    stderr ("\n  **Need 'company name' 'team name' **, quoted if needed.\n")
    api.clean_exit(usage_tail(pgm, usage, 1))
company = args[0]
team = args[1]
if popts['request']:
    req = strip_csv(popts['request'])
    request =  req.split(',')
else:
    request = None
(total, joblist) = jobs_managed(api, company, team, request=request,
                                                            save_xml=api.debug)
if total == 0:
    stderr("No jobs currently managed by {0:s}\n".format(company))
    api.clean_exit(0)
hdr = '----- Job {0:2d} of {1:d} ----\n'
for n in range(total):
    header = hdr.format(n+1, total)
    job = joblist[n]
    stdout(header)
    print_dict(stdout, job)
api.clean_exit(0)
Exemple #3
0
(pgm, ext) = path.splitext(path.basename(sys.argv[0]))
(api, argv) = app_main(pgm, sys.argv[1:], usage)
(popts, args) = parse_request(pgm, argv, usage)
if popts is None:
    api.clean_exit(1)
if popts["request"]:
    req = strip_csv(popts["request"])
    kwargs = str2kwargs(req)
    # request =  req.split(',')
else:
    # request = None
    kwargs = None

# HERE
# stdout('\nquery/test/providers.py: kwargs = {0!r}\n'.format(kwargs))

all_providers = provider_search(api, save_xml=api.debug, **kwargs)
# HERE
if not all_providers or len(all_providers) == 0:
    stderr("No providers returned.\n")
print all_providers
api.clean_exit(0)
#########################################
for n in range(len(all_providers)):
    company = all_providers[n]
    hdr = "------ provider {0:2d} ------\n".format(n + 1)
    stdout(hdr)
    print_dict(stdout, company)
    stdout("\n")
api.clean_exit(0)
 
        "buyer_team__id, buyer_team__reference, created_time,
         engagement_job_type, engagement_start_date, engagement_title,
         estimated_duration, estimated_duration_id, hourly_charge_rate,
         hourly_pay_rate, job__reference, job__title, offer__reference,
         provider__id, provider__reference, reference, role, status,
         weekly_hours_limit, weekly_salary_charge_amount,
         weekly_salary_pay_amount"

         Default is to return all of the above.
"""
(pgm, ext) = path.splitext(path.basename(sys.argv[0]))
(api, argv) = app_main(pgm, sys.argv[1:], usage)
(popts, args) = parse_request(pgm, argv, usage)
if popts is None: api.clean_exit(1)
if not len(args) == 1:
    stderr ("\n  ** Need engagement reference number **\n")
    api.clean_exit(usage_tail(pgm, usage, 1))
if popts['request']:
    req = strip_csv(popts['request'])
    request =  req.split(',')
else:
    request = None
ref_no = args[0]
details = engagement_details(api, ref_no, request=request, save_xml=api.debug)
if not details:
    stderr('failed to fetch engagement details\n')
    api.clean_exit(1)
print_dict(stdout, details)
api.clean_exit(0)
Exemple #5
0
       "fields" should be a comma-seperated list of fields. This limits the
        information returned and should be a subset of:

        "parent_team__id, is_hidden, status, name, company_name,
         parent_team__name, company__reference, parent_team__reference,
         reference, id"

        For example: -r ""
               or   -r "id"
"""
(pgm, ext) = path.splitext(path.basename(sys.argv[0]))
(api, argv) = app_main(pgm, sys.argv[1:], usage)
(popts, args) = parse_request(pgm, argv, usage)
if popts is None: api.clean_exit(1)
if popts['request']:
    req = strip_csv(popts['request'])
    request =  req.split(',')
else:
    request = None
teamlist = teams(api, request=request,save_xml=api.debug)
if not teamlist or len(teamlist) == 0:
    stderr('failed to fetch team list\n')
hdr = '----- team {0:2d} ----\n'
for n in range(len(teamlist)):
    header = hdr.format(n+1)
    team = teamlist[n]
    stdout(header)
    print_dict(stdout, team)
api.clean_exit(0)
Exemple #6
0
    return (popts, args)

(pgm, ext) = path.splitext(path.basename(sys.argv[0]))
(api, argv) = app_main(pgm, sys.argv[1:], usage)
(popts, args) = parseargs(pgm, argv, usage)
if not len(args) > 0:
    stderr('No provider key(s) given...\n')
    api.clean_exit(1)
#print 'args:', args
#api.clean_exit(1)
provider_keys = ""
for key in args:
    provider_keys += "{0:s} ".format(key)
if popts['request']:
    req = strip_csv(popts['request'])
    request =  req.split(',')
else:
    request = None
all_profiles = provider_profile(api, provider_keys, request=request,
                                    brief_listing=False, save_xml=api.debug)
if not all_profiles or len(all_profiles) == 0:
    stderr('Failed to get profile data.\n')
    api.clean_exit(1)
for n in range(len(all_profiles)):
    profile = all_profiles[n]
    hdr = '------ profile {0:2d} ------\n'.format(n+1)
    stdout(hdr)
    print_dict(stdout, profile)
    stdout('\n')
api.clean_exit(0)
Exemple #7
0
        elif key == '-i' or key == '--input': popts['input'] = to_str(val)
        elif key == '-o' or key == '--output': popts['output'] = to_str(val)
        elif key == '-t' or key == '--tag': popts['tag'] = to_str(val)
        else:
            e = "Error in parseargs code: option parsed by getopt not matched."
            stderr("{0:s}\n".format(e), 'parseargs')
            exit(1)
    return (popts, args)

(pgm, ext) = path.splitext(path.basename(sys.argv[0]))
(popts, args) = parseargs(pgm, sys.argv[1:])
if not popts['input']:
    stderr("\n\tNeed input XML file.\n")
    exit(usage(pgm, 1))
if not popts['tag']:
    stderr("\n\tNeed XML node (tag) to parse on.\n")
    exit(usage(pgm, 1))

infile = popts['input']
tag = popts['tag']
outfile = popts['output']
xml = data_from_file(infile)
ulist = list_from_xml(xml, tag, False)

if not outfile: fh = stdout
else: fh = open(outfile, 'w')
for n  in range(len(ulist)):
    print_dict(fh, ulist[n])
    fh.write('\n')
if outfile: fh.close()
Exemple #8
0
  [OPTIONS]
  -r, --request "list,of,info"
        list should be a comma-seperated list of parameters.  This limits the
        information returned and should be a subset of:

        "affiliation_status, company__name, company__reference,
         engagement__reference, has_team_room_access, parent_team__id,
         parent_team__name, parent_team__reference, permission, reference,
         role, team__id, team__name, team__reference, user__first_name,
         user__id, user__is_provider, user__last_name, user__reference"

        Default is to return all of the above.
"""
(pgm, ext) = path.splitext(path.basename(sys.argv[0]))
(api, argv) = app_main(pgm, sys.argv[1:], usage)
(popts, args) = parse_request(pgm, argv, usage)
if popts is None: api.clean_exit(1)
if popts['request']:
    req = strip_csv(popts['request'])
    request =  req.split(',')
else:
    request = None
roles  = user_roles(api, request=request, save_xml=False)
if not roles or len(roles) == 0:
    stderr('failed to fetch user roles\n')
    api.clean_exit(1)
for role in roles:
    print_dict(stdout, role)
    stdout('\n')
api.clean_exit(0)
Exemple #9
0
       weekly_salary_pay_amount, weekly_stipend_hours"

        For example: -r 'provider__id, reference'

        Default is to return all of the above.
"""
(pgm, ext) = path.splitext(path.basename(sys.argv[0]))
(api, argv) = app_main(pgm, sys.argv[1:], usage)
(popts, args) = parse_request(pgm, argv, usage)
if not len(args) == 1:
    stderr ("\n  ** Need a 'team name' **, quoted if needed.\n")
    api.clean_exit(usage_tail(pgm, usage, 1))
team = args[0]
if popts['request']:
    req = strip_csv(popts['request'])
    request = req.split(',')
else:
    request=None
kwargs = {'status': 'active', 'save_xml':api.debug}
engagements = team_engagements(api, team, request=request,**kwargs)
if not engagements:
    stderr('failed to fetch team engagement list\n')
    api.clean_exit(1)
hdr = '----- Engagement {0:n}  ----\n'
for n in range(len(engagements)):
    header = hdr.format(n+1)
    e = engagements[n]
    stdout(header)
    print_dict(stdout, e)
api.clean_exit(0)