-
-
Save Kuranes/5046175 to your computer and use it in GitHub Desktop.
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="" | |
import json | |
import base64 | |
import urllib2 | |
url="https://api.sketchfab.com/v1/models" | |
data = { | |
'title': title, | |
'description': description, | |
'fileModel': open(path+filename, 'rb'), | |
'filenameModel': filename, | |
'tags': tags, | |
'token': token_api, | |
'private': private, | |
'password': password | |
} | |
datamulti, headers = multipart_encode(data) | |
request = urllib2.Request(url, datamulti, headers, None, True) | |
print urllib2.urlopen(request).read() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated in order to allow uploads on win32