Thank you for the guidance. I am still struggling with using the client to connect to a locally running grafeas database.
Once the database is up I can curl grafeas using --
curl http://localhost:8080/v1beta1/projects -- and get a response. However, when I create a client connection using the code below I get a 404. It is connecting to the locally running grafeas (I get a different error message when the container is stopped).
It looks like the default resource_path is
v1alpha1 and the current grafeas container uses
v1beta1. I can update the setup.py /config.py to
v1beta1 and re-install but my greater concern is that there are other changes beyond the grafeas endpoint. Is there a new version of the client we should use? If there is not, do we muddle through and issue PR's to the client. Relevant issue post on github (
https://github.com/grafeas/client-python/issues/9 ) .
Thanks in advance for all your help!
Dan
##########################################################################
Response when using curl
--------------------------------------------------------
{"projects":[],"nextPageToken":""}
Response when using python code
-----------------------------------------------------
Exception when calling GrafeasApi->create_note: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Content-Type': 'text/plain; charset=utf-8', 'Vary': 'Origin', 'X-Content-Type-Options': 'nosniff', 'Date': 'Wed, 10 Mar 2021 01:08:45 GMT', 'Content-Length': '10'})
HTTP response body: Not Found
Code
-----------------------------------------------------
from __future__ import print_function
import time
import grafeas
from grafeas.rest import ApiException
from grafeas.api_client import ApiClient
from pprint import pprint
from grafeas.configuration import Configuration
# Create the client connection to the locally running DB
connection = Configuration()
connection.verify_ssl = False
# Create the api_client connection
api_client = ApiClient(configuration=connection)
# Create the api projects instance
api_projects_instance = grafeas.GrafeasProjectsApi(api_client=api_client)
try:
api_list_response = api_projects_instance.list_projects()
pprint(api_list_response)
except ApiException as e:
print("Exception when calling GrafeasApi->create_note: %s\n" % e)