Created
September 14, 2012 11:47
-
-
Save sbouafif/3721478 to your computer and use it in GitHub Desktop.
Sketchfab API - Python
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
# easy_install poster | |
from poster.encode import multipart_encode | |
from poster.streaminghttp import register_openers | |
import urllib2 | |
# Register the streaming http handlers with urllib2 | |
register_openers() | |
path="./" | |
filename="model.dae" | |
description="Test of the api with a simple model" | |
token_api="ff00ff" | |
title="Uber Glasses" | |
tags="test collada glasses" | |
private=1 | |
password="Tr0b4dor&3" | |
import json | |
import base64 | |
import urllib2 | |
url="https://api.sketchfab.com/v1/models" | |
data = { | |
'title': title, | |
'description': description, | |
'fileModel': open(path+filename), | |
'filenameModel': filename, | |
'tags': tags, | |
'token': token_api, | |
'private': private, | |
'password': password | |
} | |
datamulti, headers = multipart_encode(data) | |
request = urllib2.Request(url, datamulti, headers) | |
print urllib2.urlopen(request).read() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment