Skip to content

Instantly share code, notes, and snippets.

@cedricpinson
Created May 3, 2012 13:18
Show Gist options
  • Save cedricpinson/2585540 to your computer and use it in GitHub Desktop.
Save cedricpinson/2585540 to your computer and use it in GitHub Desktop.
sketchfab api
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
import urllib2
register_openers()
filename="../data/model.zip"
description="Test of the api with a simple model"
token_api="xxxxxxxxxxxxxxxxx"
title="model title"
tags="test"
url="https://api.sketchfab.com/v1/models"
params = {
'fileModel': open(filename),
'title':title,
'description': description,
'tags': tags,
'token': token_api
}
datagen, headers = multipart_encode(params)
request = urllib2.Request(url, datagen, headers)
print urllib2.urlopen(request).read()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment