When I use
Mathematica will popup a window like:
Actually I have given the parameters
HTTPRequest, but they seem invalid. Any programmatic method to fill this form so it won't popup?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.Sign up to join this community
For new functions it is enough to use documented
URLRead["https://httpbin.org/status/401", Interactive -> False]
URLDownload so here's a workaround:
URLFetchand friends solutions
There is an undocumented option
DisplayProxyDialog which prevents that:
URLFetch[ "https://httpbin.org/status/401" , "StatusCode" , "DisplayProxyDialog" -> False ]
As OP noticed it works for
URLRead even though it does not appear in
Options[URLRead] in contrary to
When switched off you can handle 401 status code however you like, abort, prompt custom dialog etc.
I have not guessed it, WRI Support suggested it to my friend when he asked:
[...] Just informed by our development group that there is such an option (all-be-it undocumented):
"DisplayProxyDialog" -> False
to omit the authentication dialog. [...]
So I suppose this makes it safe to use.