Python store password more securely via POST API request
<p>I have a script that utilizes the request module to create a POST request.</p>

<p>The password is stored in plain text in the script.</p>

<p>I am concerned that this is blatantly insecure, but I am not sure how to make it more secure.</p>

<p>Any suggestions on steps I can take to avoid storing the password in plain text in the script to make the request?</p>

<pre><code>#Set request parameters
url = 'https://apiexample.com/test'
#ISSUE: password is plain text
user = 'api_example'
pwd = 'plaintextnopes'

#Set proper headers
headers = {"Content-Type":"application/json","Accept":"application/json"}

#Build HTTP Request
response = requests.post(url=url, auth=(user, pwd), headers=headers ,data=j)

#Check for HTTP codes other than 200
if response.status_code != 200:
        print('Status:', response.status_code, 'Headers:', response.headers, 'Response Text', response.text, 'Error Response:',response.json())
        exit()
</code></pre>

<p>EDIT:
The account is the system user that has access to write records to the database, this is static, it will not change.</p>