Closed dreammelter closed 3 years ago
Since the NLU service was connected to the app, I tried using just the endpoint URL with instance/service ID, but no dice. All the results are returned with "unauthorized" - meaning an APIKEY needs to get involved somewhere, as suspected.
(Unless there's a different step missing in the step where I connect the services... VCAP_SERVICES seems to be holding onto some creds.)
....PR accidentally auto-closed.
Sentiment analysis now works both locally and in Cloud Foundry w/ latest build!
Quick notes on env vars/accessing them:
"""
VCAP is a dict
-- NLU []
----another dict in which 'credentials'{} sits
-------then in there is the apikey and url.
"""
if 'VCAP_SERVICES' in os.environ:
vcap_svcs = json.loads(os.environ['VCAP_SERVICES'])
NLU_SVC=vcap_svcs['NLU'][0]?
NLU_SVC_CREDS=NLU_SVC.get('credentials')
NLU_SVC_CREDS['apikey']
Task 3/4 to create the proxy services for the Cloud functions. Incorporate Watson NLU in
get_dealer_details
view for analyzing review sentiment