Skip to content

Instantly share code, notes, and snippets.

@niharsawant
Created April 25, 2012 13:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niharsawant/2489894 to your computer and use it in GitHub Desktop.
Save niharsawant/2489894 to your computer and use it in GitHub Desktop.
STL Upload to Shapeways
import SOAPpy
import base64
SHAPEWAYS_SOAP_URL = "http://www.shapeways.com/modules/shapeways_api/webservice/v1/soap.php"
USERNAME = 'user'
PASSWORD = 'password'
def main():
server = SOAPpy.SOAPProxy(SHAPEWAYS_SOAP_URL)
session = server.login(USERNAME, PASSWORD)
print 'Session Key :', session
model = open('test.stl', 'rb')
#print 'Getting list of printers.....'
#response = server.getPrinters(session)
#print response
print 'Uploading model to Shapeways.....'
upload_data = dict(
title = 'Shapways Upload',
file = base64.b64encode(model.read()),
filename = model.name,
modeltype = 'STL',
has_color = 0,
scale = 0.001,
desc = 'Testing Shapways Upload'
)
response = server.submitModel(session, upload_data, None, 'Shapeways Upload Test')
print response
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment