Skip to content

Instantly share code, notes, and snippets.

@pierreant-p
pierreant-p / sketchfab-folder-api.py
Last active December 15, 2015 02:18
Sketchfab folder API
import urllib
import urllib2
api_token = "FF00FF" # your api token
##
# Create a new folder
# POST to https://api.sketchfab.com/v1/folders
##
@pierreant-p
pierreant-p / gist:5806781
Last active December 18, 2015 15:49
Sample code for uploading to Sketchfab in C#
/**
* Ensure that you have MultipartForm imported in your project
*/
string url = @ "https://api.sketchfab.com/v1/models";
MultipartForm form = new MultipartForm (url);
form.SetField ("title", "Uber Glasses");
form.SetField ("description", "Test of the api with a simple model");
form.SetField ("token", "FF00FF");
@pierreant-p
pierreant-p / gist:7417126
Last active December 28, 2015 00:59
Serializers inheritance test
import random
from django.db import models
from rest_framework import serializers
class Toto(models.Model):
description = models.CharField()
is_lol = models.BooleanField()
@pierreant-p
pierreant-p / sketchfab-cocao.m
Created November 26, 2013 23:22
Upload to Sketchfab with Cocoa
//
// AppDelegate.m
// Upload to Sketchfab sample code
//
// Created by Pierre-Antoine Passet on 11/26/13.
// Copyright (c) 2013 Sketchfab. All rights reserved.
//
#import "AppDelegate.h"
#import "AFHTTPRequestOperation.h"
# crafted with love by https://github.com/cambonf
from __future__ import print_function
from urllib.request import urlopen, Request
import mimetypes
import random
import string
# Encode form-data without external dependencies
# easy_install poster
import datetime
import threading
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
import urllib2
import json
import base64
register_openers()
@pierreant-p
pierreant-p / sketchfab-iframe.js
Created April 8, 2014 10:37
iframe API for the Sketchfab viewer (pending deprecation)
( function ( root, factory ) {
root[ 'sketchfab-iframe' ] = factory( );
} ( this, function ( ) {
/**
* almond 0.2.5 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details
*/
//Going sloppy to avoid 'use strict' string cost, but strict practices should
@pierreant-p
pierreant-p / sketchfab-v2-upload-requests.py
Last active May 6, 2020 18:52
Sketchfab - v2 api upload with requests library
##
# Sample script for uploading to sketchfab
# using the v2 api and the requests library
##
from time import sleep
# import the requests library
# http://docs.python-requests.org/en/latest
# pip install requests
import requests
Verifying that +pap is my openname (Bitcoin username). https://onename.io/pap
@pierreant-p
pierreant-p / sketchfab-oembed-patterns.py
Last active December 6, 2016 07:15
sketchfab oembed patterns
import re
# urls for matching models
regex = re.compile(r'^http(s?)://sketchfab.com/(show|models)/(?P<urlid>\w+)')
# Examples
https://sketchfab.com/models/62d77e6a14284e91b2f737d6909e965d
https://sketchfab.com/models/b7LzIm8JrnPw4GBDOMBNGYc39qM
https://sketchfab.com/models/4f4802d5c24847fda35408eed5f9a066