UPDATE:
From here, I found that I can use the:
x = read(secretbuffer_from_getpass, string)
to get the password string.
So this solves the 1st question.
However, now I am getting the following error:
ERROR: LoadError: HTTP.ExceptionRequest.StatusError(401, "GET", "/rest/api/2/search", HTTP.Messages.Response:
"""
HTTP/1.1 401 Unauthorized
X-AREQUESTID: 1390x6515484x10
X-ANODEID: node2
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self'
X-ASEN: SEN-10264611
X-Seraph-LoginReason: AUTHENTICATED_FAILED
WWW-Authenticate: OAuth realm=**************
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 19 Jan 2021 04:10:18 GMT
Equivalent script in python works without any issues.