import base64
import json

import requests

class YdmVerify(object):
    _custom_url = "https://www.jfbym.com/api/YmServer/customApi"
    _token = "HhUGwpI6AtQGoux36i1ZpsDv7hwGSbr1hQ0RX-HXSZE"
    _headers = {
        'Content-Type': 'application/json'
    }

    def rotate(self, image):
        payload = {
            "image": base64.b64encode(image).decode(),
            "token": self._token,
            "type": "90009"
        }
        resp = requests.post(self._custom_url, headers=self._headers, data=json.dumps(payload))
        return resp.json()['data']['data']