api-examples icon indicating copy to clipboard operation
api-examples copied to clipboard

error while 'python python/test.py images/algebra.jpg'

Open RayXu14 opened this issue 6 years ago • 1 comments

{ "error": "Invalid credentials", "error_info": { "id": "http_unauthorized", "message": "Invalid credentials" } }

what does this means? I use python3.6, so my code is

#!/usr/bin/env python
import sys
import base64
import requests
import json

file_path = sys.argv[1]
image_uri = "data:image/jpg;base64," + base64.b64encode(open(file_path, "rb").read()).decode()
r = requests.post("https://api.mathpix.com/v3/latex",
    data=json.dumps({'src': image_uri,
        'formats': ['latex_normal', 'latex_styled']}),
    headers={"app_id": "trial", "app_key": "34f1a4cea0eaca8540c95908b4dc84ab",
        "Content-type": "application/json"})
print(json.dumps(json.loads(r.text), indent=4, sort_keys=True))

RayXu14 avatar Aug 04 '18 14:08 RayXu14

I meet the same error.how you solved it?

qiangruoyu avatar Mar 12 '19 15:03 qiangruoyu