The previous recipes to connect to the Junos OS REST server might cause frustration for any application that needs to run in an unattended manner. Who will enter the password? This is not automation!
Dealing with the safe storage of security credentials can be tricky. The automation script needs to be able to read the credentials in a clear manner in order to complete the authentication process with the Junos OS device. But in most application execution environments, the permission to execute the app usually coincides with the permission to read the app executable file and, for just-in-time interpreted script languages, that includes the sensitive credentials.
People sometimes try to get around this problem by using a command line switch or an environment variable to store a password. This approach can be problematic though because, on most UNIX systems...