Short answer is no... but....
If there are no server side options you can harden the security.
- If this is local intranet then isolate the broadcast domain, and donot use WiFi or any radio.
- As Shameer says, use a .netrc file, keep the values out of the code.
- If you trust that memory is safe, use environmental vars. $PSWD.
- If this is automation, run from root's crontab.
- ...in a container.
- ...from a VM with an encrypted disk.
None of these are any less secure than a browser using HTTP.