Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Staff (Retired)
Web site wants a password

Question from @billkopp.

Using cURL to supply basic authentication credentials.  Replace "user" and "pass"  appropriately.  Remove the -k if you don't need it; it bypasses the checking for a valid signing authority on an https site's certificate (you probably know if you are using a self-signed certificate...then you'll need it).  DO use https if available; it will keep others from seeing the password...unless your script is left on your screen...

The example assumes Windows users put a copy of curl.exe on the desktop.  Mac users are good to go.

The last two lines open the downloaded CSV in JMP and do some basic error reporting.



if( HostIs("Windows"),
  data = RunProgram(
  executable( Convert File Path( "$desktop", windows ) || "curl.exe" ),
  options( "-k -s -u user:pass --basic" ),
  readfunction( "blob" )
, // else mac version
  data = RunProgram(
  executable( "/usr/bin/curl" ),
  options( {"-k", "-s", "-u", "user:pass", "--basic", ""} ),
  readfunction( "blob" )
try( dt = open(data, "text"); error="", error=exception_msg; dt=empty() );



Article Labels

    There are no labels assigned to this post.

Article Tags