Created
May 3, 2012 13:18
-
-
Save cedricpinson/2585540 to your computer and use it in GitHub Desktop.
sketchfab api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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