From 509e7417762eb5c382bef9c1f1487fa96668e1e2 Mon Sep 17 00:00:00 2001 From: Glenn Snyder Date: Wed, 25 Jan 2023 14:22:40 -0500 Subject: [PATCH] adding a null example to demonstrate the process of adding a example through PR --- examples/client/new_example.py | 54 ++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 examples/client/new_example.py diff --git a/examples/client/new_example.py b/examples/client/new_example.py new file mode 100644 index 00000000..6a7239ca --- /dev/null +++ b/examples/client/new_example.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python + +''' +Copyright (C) 2021 Synopsys, Inc. +http://www.blackducksoftware.com/ + +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. + +''' +import argparse +import json +import logging +import sys + +from blackduck import Client + +parser = argparse.ArgumentParser("Program description") +parser.add_argument("base_url", help="Hub server URL e.g. https://your.blackduck.url") +parser.add_argument("token_file", help="containing access token") +parser.add_argument("--no-verify", dest='verify', action='store_false', help="disable TLS certificate verification") +parser.add_argument("arg1") +args = parser.parse_args() + + +logging.basicConfig(format='%(asctime)s:%(levelname)s:%(message)s', stream=sys.stdout, level=logging.DEBUG) +logging.getLogger("requests").setLevel(logging.WARNING) +logging.getLogger("urllib3").setLevel(logging.WARNING) +logging.getLogger("blackduck").setLevel(logging.WARNING) + +with open(args.token_file, 'r') as tf: + access_token = tf.readline().strip() + +bd = Client( + base_url=args.base_url, + token=access_token, + verify=args.verify +) + +