Spaces:
Sleeping
Sleeping
| import requests | |
| import json | |
| def upload(path): | |
| headers = {'Authorization': 'YxKXccVDyLPhodqaDg4BIYNeJXSuCbkX'} | |
| files = {'smfile': open(path, 'rb')} | |
| url = 'https://sm.ms/api/v2/upload' | |
| res = requests.post(url, files=files, headers=headers).json() | |
| print(res['data']['url']) | |
| if __name__ == "__main__": | |
| upload('/home/kun/code/3d/poetry3d/mountain_1.png') | |