Discussions
Info work around for Private API in AWS Lambda (Python)
8 days ago by Tait Leaney (Owner Acct)
Hey folks,
There's many questions being asked about the Private Keys. As far as I know, Private API Keys aren't implemented (yet?).
However, the username and password is implemented (though you can't have 2 Factor Authentication activated). Here is the framework I use in AWS Lambda in Python:
import json
import boto3
import urllib3
sm8_api_URL = "sm8_api_endpoint"
user = "YOUR_USERNAME"
password = "YOUR_PASSWORD"
http = urllib3.PoolManager(cert_reqs = "CERT_REQUIRED", ca_certs = certifi.where())
secure_headers = urllib3.util.make_headers(basic_auth=user+":"+password)
r = http.request("GET", sm8_api_URL, headers=secure_headers)
contact_raw = json.loads(r.data.decode("utf-8"))
As you can tell, your username and password are in cleartext, so my suggestion would be to create a new user that is read only.
This code is only an example. I can't offer support if you can't get it working.