コード例 #1
0
def get_env_share_by_revision(environment_id, revision_id):
    account_id = config.hava["account_id"]
    url = config.hava["api"].format(resource="environments/" + environment_id +
                                    "/share?account_id=" + account_id +
                                    "&revision_id=" + str(revision_id))
    resp = requests.get(url,
                        auth=(config.hava["username"],
                              config.hava["password"]))
    return utils.handle_response(resp)
コード例 #2
0
def get_envs():
    if len(envs_summary_cache) == 0:
        resp = requests.get(
            config.hava["api"].format(resource="environments?limit=1000"),
            auth=(config.hava["username"], config.hava["password"]))
        handled_response = utils.handle_response(resp)["results"]
        utils.append_to_array(envs_summary_cache, handled_response)

    return envs_summary_cache
コード例 #3
0
def get_sources():
    if (len(sources_full_cache) == 0):
        resp = requests.get(config.hava["api"].format(resource="sources"),
                            auth=(config.hava["username"],
                                  config.hava["password"]))
        handled_response = utils.handle_response(resp)
        utils.append_to_array(sources_full_cache,
                              HavaSources(handled_response))

    return sources_full_cache
コード例 #4
0
def get_content_children(content_id):
    resp = requests.get(config.confluence["api"].format(
        resource="content/{id}/child".format(id=content_id)),
                        params={
                            "expand": "page",
                            "orderby": "title asc",
                            "limit": 500
                        },
                        auth=(config.confluence["username"],
                              config.confluence["password"]))

    handled_response = utils.handle_response(resp)
    return ConfluencePages(handled_response["page"]["results"])
コード例 #5
0
def get_content_by_space(space_key):
    resp = requests.get(config.confluence["api"].format(resource="content"),
                        params={
                            "spaceKey": space_key,
                            "type": "page",
                            "status": "current",
                            "limit": config.confluence["limit"]
                        },
                        auth=(config.confluence["username"],
                              config.confluence["password"]))

    handled_response = utils.handle_response(resp)
    return ConfluencePages(handled_response["results"])
コード例 #6
0
def get_env(id):
    if (id == None):
        raise ValueError('get_env expects "id" which was not supplied')

    if (id not in envs_full_cache):
        resp = requests.get(
            config.hava["api"].format(resource="environments/" + id),
            auth=(config.hava["username"], config.hava["password"]))
        handled_response = utils.handle_response(resp)
        env = HavaEnvironment(handled_response)
        envs_full_cache[env.id] = env

    return envs_full_cache[env.id]
コード例 #7
0
def get_content_body(content_id):
    resp = requests.get(config.confluence["api"].format(
        resource="content/{id}?expand=page,body.storage".format(
            id=content_id)),
                        params={
                            "expand": "page",
                            "orderby": "title asc",
                            "limit": 500
                        },
                        auth=(config.confluence["username"],
                              config.confluence["password"]))

    handled_response = utils.handle_response(resp)
    return handled_response["body"]["storage"]["value"]