Skip to content

Instantly share code, notes, and snippets.

@revolunet
Created April 12, 2013 23:59
Show Gist options
  • Select an option

  • Save revolunet/5376129 to your computer and use it in GitHub Desktop.

Select an option

Save revolunet/5376129 to your computer and use it in GitHub Desktop.
sample sketchfab API upload
# -*- encoding: UTF-8 -*-
import os
# pip install requests if not installed
import requests
def sketchfab_send(fullpath, title, tags='', description=''):
''' sends a 3D model to the sketchfab API '''
url = 'https://api.sketchfab.com/v1/models'
token_api = '123abc'
private = 1
password = 'sketchfabrox'
data = {
'title': title,
'description': description,
'fileModel': open(fullpath).read(),
'filenameModel': os.path.basename(fullpath),
'tags': tags,
'token': token_api,
'private': private,
'password': password
}
result = requests.post(url, data=data)
return result.content
result = sketchfab_send('/path/to/model.dae',
title='My awesome model',
tags='test collada glasses',
description='This is my first sketchfab upload'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment