Hi @mark fung-a-fat ,
Can you share your AA Code Snippet?
Chandu
import json
def myfunc(mystr: str) -> str:
data = json.loads(mystr)
return datan'meta']
this is the code I put in the open script: manual
this is the code that I put into the function call and i pass a string that is json that returned from my rest call
Hi @mark fung-a-fat ,
Could you try the following snippet and see if that works out for you?
import json
def myfunc(mystr):
data = json.loads(mystr)
return datau'meta']
Kind Regards,
Ashwin A.K
Glad I could help!
I'd appreciate it if you marked my solution as "Best" so that others facing similar issues may benefit from it as well.
Kind Regards,
Ashwin A.K
Hi @Ashwin A.K and @ChanduMohammad , I am executing this script outside A360 and getting response but while executing same in A360 it is saying Bot error. Can you please check and let me know where exactly the issue is? do I need to install any libraries, if yes please guide me through. thank you.
import datetime
import base64
import hmac
import hashlib
import time
def hmac_sha256(message, key):
key = bytes(key, 'UTF-8')
message = bytes(message, 'UTF-8')
h = hmac.new(key, message, hashlib.sha256)
return base64.b64encode(h.digest()).decode()
def authorization(strAKID, strAKSecret):
#AK/SK information
strDateNow = datetime.datetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT')
print(f"date is: {strDateNow}")
strSignContent = "date: {}".format(strDateNow)
#Compute signature, get authorization
strSignature = hmac_sha256(strSignContent, strAKSecret)
print(f"signature is: {strSignature}")
strAuthorization = '''hmac username="{}", algorithm="hmac-sha256", headers="date", signature="{}"'''.format(strAKID, strSignature)
if __name__ == '__main__':
# miral test env
strAKID = "e2c5b464-5361-40f2-9c8e-bc04962db1a7"
strAKSecret = "I5lGga3vfFW8Nf9HbRHuUnROcga0SnpP"
authorization(strAKID, strAKSecret)