Hello,
Is it possible to get the NLU API to send custom headers and/or user-agent in the request it makes to the target server URL?
By target server I mean the one that is serving the content for the URL specified as a name parameter to `analyze` method.
For example, using Python SDK:
natural_language_understanding = NaturalLanguageUnderstandingV1(
version='2019-07-12',
authenticator=authenticator
)
natural_language_understanding.set_service_url(nlu_url2)
headers = {
'X-Custom-Header': 'Value'
}
target_url = "http://myserver.com"
natural_language_understanding.set_default_headers(headers) # point A
response = natural_language_understanding.analyze(
url=target_url,
headers=headers, # point B
features=Features(categories=CategoriesOptions(limit=3))).get_result()
neither setting headers in point A nor point B makes the server at "myserver.com" see the custom X-Custom-Header header.
I am suspecting the set_default_headers and the named param "headers" for "analyze" are meant to send headers to IBM Watson service, not through it.
The problem I am trying to solve is that some of the target servers I use (where "myserver.com" is in the example) interpret IBM Watson's request as being sent from a bot and reject it not emitting any content. Setting a header would allow me to include extra information for the content server to recognize IBM Waton's request as legitimate.
Would anyone know if its possible to set headers/user-agent on the request at all?
Or whether there are better solutions to the problem altogether :)
Many thanks
------------------------------
Arunsa Cesonis
------------------------------
#BuildwithWatsonApps#EmbeddableAI