Please can you post a sample python file that can perform sync screening requests for the WC1 API?

Please can you post a sample python file that can perform sync screening requests for the WC1 API?

Best Answer

  • Irfan.Khan
    Answer ✓

    @Yusuf.Jassat

    Please find the python script to request the API call "SEQ-screen-sync-simple: Perform Synchronous Screening: Simple" in the attached.

    Kindly note that this is just a sample python code designed to describe the users on how to write their own code. This should not be used in the client's production application.

Answers

  • hi im new to wc1 api, im trying to modify the python code you posted to get group info, very basic, however, the signature generated from the code is different from postman, why would that be the case? below is the code im using


    api_token=api_secret.encode()

    datatosign= "(request-target): get " + gatewayurl + "groups\n" + \

    "host: " + gatewayhost + "\n" + \

    "date: " + date + "\n"

    #"date: " + date + "\n" +\

    #"content-type: " + content_type +"\n" +\

    #"content-length: " + str_length +"\n"+\

    #content.decode()


    print (datatosign)


    byte_datatosign=datatosign.encode()

    def hbase(byte_datatosign,api_token):

    encrypt=hmac.new(api_token, byte_datatosign, digestmod= hashlib.sha256)

    digest_maker=encrypt.digest()

    base=base64.b64encode(digest_maker)

    return base.decode()

  • found the issue, remove the extra "\n" in "date: " + date + "\n" worked for me