Start a new topic
iink SDK Web
Hi, I am having trouble computing the hmac value in python 3 when running the example in https://swaggerui.myscript.com/#/batch-mode-controller/batchUsingPOST
here is my hmac computation:
myscript_api_url = "https://cloud.myscript.com/api/v4.0/iink/batch" hmac_keys = "xxx" application_keys = "xxx" body = """{ "configuration": { "alwaysConnected": true, "diagram": { "convert": { "edge": true, "node": true, "text": true }, "enable-sub-blocks": true, "text": { "addLKText": true, "customLexicon": [ "word1", "word2" ], "customResources": [ "your_custom_resource" ] } }, "export": { "image-resolution": 300, "jiix": { "bounding-box": false, "strokes": true, "style": false, "text": { "chars": false, "words": true } } }, "lang": "en_US", "math": { "customGrammarContent": "symbol = 0\\nexpression ::= identity(symbol)\\nstart(expression)", "customGrammarId": "your_custom_grammar_id", "margin": { "bottom": 10, "left": 15, "right": 15, "top": 10 }, "solver": { "angle-unit": "deg", "decimal-separator": ".", "enable": true, "fraction-mode": "decimal", "fractional-part-digits": 3, "options": "algebraic", "rounding-mode": "half up" } }, "raw-content": { "recognition": { "shape": true, "text": true }, "text": { "addLKText": true, "customLexicon": [ "word1", "word2" ], "customResources": [ "your_custom_resource" ] } }, "text": { "configuration": { "addLKText": true, "customLexicon": [ "word1", "word2" ], "customResources": [ "your_custom_resource" ] }, "guides": { "enable": true }, "margin": { "bottom": 10, "left": 15, "right": 15, "top": 10 } } }, "contentType": "Text", "conversionState": "DIGITAL_EDIT", "height": 620, "strokeGroups": [ { "penStyle": "color: #120f51;↵-myscript-pen-width: 2;", "penStyleClasses": "ink mycolor", "strokes": [ { "id": "string", "p": [ 0.5, 0.8221720589961077, 0.7145158745241171, 0.6761535882018319, 0.6761535882018319, 0.6761535882018319, 0.7145158745241171, 0.6831899108492184, 0.7145158745241171, 0.6831899108492184, 0.6831899108492184 ], "pointerId": 0, "pointerType": "PEN", "t": [ 1516717383637, 1516717383677, 1516717383694, 1516717383711, 1516717383727, 1516717383744, 1516717383761, 1516717383777, 1516717383794, 1516717383811, 1516717383827 ], "x": [ 289, 290, 290, 290, 290, 290, 290, 291, 291, 292, 293 ], "y": [ 215, 218, 222, 225, 228, 231, 235, 238, 242, 245, 248 ] } ] } ], "theme": "ink {color: #000000; -myscript-pen-width: 1; -myscript-pen-fill-style: none; -myscript-pen-fill-color: #FFFFFF00;} mycolor {color: #120f51;} .math { font-family: STIXGeneral;} .math-solved {font-family: STIXGeneral; color: #A8A8A8FF;} .text {font-family: Open Sans; font-size: 10;}", "width": 722, "xDPI": 96, "yDPI": 96 }""" import hashlib import hmac import json data = bytes(json.dumps(body), "utf-8") user_key = bytes(application_keys + hmac_keys, "utf-8") h = hmac.new(user_key, data, hashlib.sha512).hexdigest() print(h)
But I keep getting 401 "Access not granted" Error, did I do something wrong?
Dear Marco,
thank you for contacting us.
Currently, I recommend you refer to the following post, which is similar to yours: https://developer-support.myscript.com/support/discussions/topics/16000025340
Indeed, you set several modes (text, raw-content, math...) while only one shall be set at a time.
Reviewing your request to make is simply as possible (e.g. only text mode, no specific resource...), it should work properly
Best regards,
Olivier
Marco Lee
Hi, I am having trouble computing the hmac value in python 3 when running the example in https://swaggerui.myscript.com/#/batch-mode-controller/batchUsingPOST
here is my hmac computation:
But I keep getting 401 "Access not granted" Error, did I do something wrong?
Dear Marco,
thank you for contacting us.
Currently, I recommend you refer to the following post, which is similar to yours: https://developer-support.myscript.com/support/discussions/topics/16000025340
Indeed, you set several modes (text, raw-content, math...) while only one shall be set at a time.
Reviewing your request to make is simply as possible (e.g. only text mode, no specific resource...), it should work properly
Best regards,
Olivier
Olivier @MyScript
Dear Marco,
thank you for contacting us.
Currently, I recommend you refer to the following post, which is similar to yours: https://developer-support.myscript.com/support/discussions/topics/16000025340
Indeed, you set several modes (text, raw-content, math...) while only one shall be set at a time.
Reviewing your request to make is simply as possible (e.g. only text mode, no specific resource...), it should work properly
Best regards,
Olivier