1. Get Photo Upload Url

1 Function description

Get a link to upload the user pose image.

Note that each call will consume 0.1 coins.

2 Request method

method:POST URL :{ApiUrl}/api/inf/inf_upload

3 Request parameter

nametypedescribesample

openId

string

your openId

apiKey

string

our apiKey

fileName

string

filename

test_input.png

    infId = -1
    upload_url = ''
    params = {'openId':OpenId, 'apiKey':ApiKey, 'fileName':'test_input.png'}
    session = requests.session()
    ret = requests.post(f"{ApiUrl}/api/inf/inf_upload", data=json.dumps(params))
    res = 0
    if ret.status_code==200:
        if 'data' in ret.json():
            print(ret.json())
            data = ret.json()['data']
            infId = data['infId']
            upload_url = data['uploadUrl']
            """
                [Success] An example returns the result
                {'code': 200, 'msg': 'ok', 'data': {'infId': 3609, 
                'uploadUrl': 'xxx'}}
            """
            print("current infId is: ", data['infId'], " Be sure to remember this id! Otherwise, the task cannot be queried")
            print("The image upload link is: ", data['uploadUrl'])
        else:
            """
                【fail】
                {'code': 500, 'msg': 'You have 0.0 coins, but try-on need 5'}
            """
            print(ret.json())
            data = ret.json()
            print("info is, ", data)
            exit(0)

Last updated