Beispiel #1
0
def get_group(grp_name):
    url = myconf.gitlaburl() + 'groups'
    groups_resp = unirest.get(url,
                              headers={"PRIVATE-TOKEN":
                                       myconf.token()})  # need to cache this
    group_data = json.loads(groups_resp.raw_body)
    for group in group_data:
        if group['name'] == grp_name:
            return group['id']
    return False
Beispiel #2
0
argv = sys.argv[1:]

if not argv:
    usage()

myopts = "n:p:i:"
opts, args = getopt.getopt(argv, myopts)

if 1 > len(opts):
    usage()

project_namespace = myconf.defaultns()
project_id = 0

for opt, val in opts:
    if opt == '-h':
        usage()
    elif opt == "-n":
        project_namespace = val
    elif opt == "-p":
        project_id = project_namespace + '/' + val
    elif opt == "-i":
        project_id = val

project_id = myconf.urlencode(project_id)

url = myconf.gitlaburl() + 'projects/' + project_id
resp = unirest.get(url, headers={"PRIVATE-TOKEN": myconf.token()})
project_data = json.loads(resp.raw_body)
print json.dumps(project_data, sort_keys=True, indent=4, separators=(',', ': '))
#!/usr/bin/python

import inspect, sys, myconf, unirest, json

url = myconf.gitlaburl() + 'groups'
if 1 < len(sys.argv):
    url += '/' + sys.argv[1] # has to be number

resp = unirest.get(url, headers={"PRIVATE-TOKEN": myconf.token()})
# print json.dumps(resp.body, sort_keys=True, indent=4, separators=(',', ': '))
project_data = json.loads(resp.raw_body)
# print json.dumps(project_data, sort_keys=True, indent=4, separators=(',', ': '))

print json.dumps(project_data[0], sort_keys=True, indent=4, separators=(',', ': '))

print project_data[0]['id']
Beispiel #4
0
project_namespace = myconf.defaultns()
project_name = ''
project_desc = ''

for opt, val in opts:
    if opt == '-h':
        usage()
    elif opt == "-n":
        project_namespace = val
    elif opt == "-p":
        project_name = val
    elif opt == "-d":
        project_desc = val

project_namespace = get_group(project_namespace)
url = myconf.gitlaburl() + 'projects'
url_data = {
    'name': project_name,
    'namespace_id': project_namespace,
    'description': project_desc
}

# # # name (required) - new project name
# # # namespace_id (optional) - namespace for the new project (defaults to user)
# # # description (optional) - short project description
# # # issues_enabled (optional)
# # # merge_requests_enabled (optional)
# # # wiki_enabled (optional)
# # # snippets_enabled (optional)
# # # public (optional) - if true same as setting visibility_level = 20
# # # visibility_level (optional)
Beispiel #5
0
    usage()

myopts = "n:p:i:"
opts, args = getopt.getopt(argv, myopts)

if 1 > len(opts):
    usage()

project_namespace = myconf.defaultns()
project_id = 0

for opt, val in opts:
    if opt == '-h':
        usage()
    elif opt == "-n":
        project_namespace = val
    elif opt == "-p":
        project_id = project_namespace + '/' + val
    elif opt == "-i":
        project_id = val

project_id = myconf.urlencode(project_id)

url = myconf.gitlaburl() + 'projects/' + project_id
resp = unirest.get(url, headers={"PRIVATE-TOKEN": myconf.token()})
project_data = json.loads(resp.raw_body)
print json.dumps(project_data,
                 sort_keys=True,
                 indent=4,
                 separators=(',', ': '))
Beispiel #6
0
#!/usr/bin/python

import inspect, sys, myconf, unirest, json

url = myconf.gitlaburl() + 'groups'
if 1 < len(sys.argv):
    url += '/' + sys.argv[1]  # has to be number

resp = unirest.get(url, headers={"PRIVATE-TOKEN": myconf.token()})
# print json.dumps(resp.body, sort_keys=True, indent=4, separators=(',', ': '))
project_data = json.loads(resp.raw_body)
# print json.dumps(project_data, sort_keys=True, indent=4, separators=(',', ': '))

print json.dumps(project_data[0],
                 sort_keys=True,
                 indent=4,
                 separators=(',', ': '))

print project_data[0]['id']
#!/usr/bin/python

import inspect, os, myconf, unirest, json

url = myconf.gitlaburl() + 'projects'
resp = unirest.get(url, headers={"PRIVATE-TOKEN": myconf.token()})
print json.dumps(resp.body, sort_keys=True, indent=4, separators=(',', ': '))