def send_request(context,
                 ecosystem=None,
                 manifest=None,
                 token='without',
                 valid='valid',
                 trans="without",
                 uuid="without",
                 invalid="without"):
    """Send the ecosystem package manifest file to the stack analysis v2."""
    # Ecosystem is mandatory
    assert ecosystem is not None

    # Convert token text into a valid bool
    with_user_key = parse_token_clause(token)
    is_user_registered = parse_token_clause(uuid)
    is_invalid = parse_token_clause(invalid)
    print(is_invalid)

    # Convert valid clause to bool
    with_valid_user_key = parse_valid_clause(valid)

    with_transitives = parse_token_clause(trans)
    post_request(context, ecosystem, manifest, with_user_key,
                 with_valid_user_key, with_transitives, is_user_registered,
                 is_invalid)
def start_rate_limit_requests(context,
                              ecosystem,
                              manifest,
                              rate,
                              user_key='with',
                              valid='valid'):
    """Multiple SA request within given time window to generate 429 (rate limit)."""
    # Convert token text into a valid bool
    with_user_key = parse_token_clause(user_key)

    # Convert valid clause to bool
    with_valid_user_key = parse_valid_clause(valid)

    # Perform loop to send requested number of request and compute duration.
    check_rate_limit(context, ecosystem, manifest, rate, with_user_key,
                     with_valid_user_key)
コード例 #3
0
def send_request(context,
                 ecosystem=None,
                 manifest=None,
                 token='without',
                 valid='valid'):
    """Send the ecosystem package manifest file to the stack analysis v2."""
    # Ecosystem is mandatory
    assert ecosystem is not None

    # Convert token text into a valid bool
    with_user_key = parse_token_clause(token)

    # Convert valid clause to bool
    with_valid_user_key = parse_valid_clause(valid)

    # Send SA request
    post_request(context, ecosystem, manifest, with_user_key,
                 with_valid_user_key)