Skip to content

Instantly share code, notes, and snippets.

@wegrata
wegrata / LR publish
Created December 12, 2013 18:35
sample code to publish to LR
import requests
import json
from pprint import pprint
data = {
"documents": [{
"doc_type": "resource_data",
"resource_locator": "https://www.example.com",
"resource_data": {
"copyrightYear": "2013",
"interactivityType": "expositive",
package main
import (
"fmt"
)
type IntWrapper struct {
x int
}
@wegrata
wegrata / ES schema
Last active December 23, 2015 06:59
{
"title": {
"index": "analyzed",
"store": "yes",
"type": "string",
},
"description": {
"index": "analyzed",
"store": "yes",
"type": "string",
import urllib2
import json
import urlparse
import urllib
from pprint import pprint
from lxml import etree
def process_nsdl_dc(envelope):
#parse the resource_data into an XML dom object
dom = etree.fromstring(envelope['resource_data'])
package main
import(
"log"
"math/big"
"crypto/rand"
"sync"
"net/http"
"net/url"
"strings"
import json
import time
import urllib2
from pprint import pprint
import oauth2 as oauth
def main():
envelope = {
'doc_type': "resource_data",
'resource_locator': "cfa-www.harvard.edu/seuforum/download/CosmicSurvey2003.pdf",
function process_tree(queue){
if(queue.length >= 0){
var node = queue.pop();
client.get(node.id, function(err, result){
node.count = result;
for(var child in node.children){
queue.push(node.children[child]);
}
process_tree(queue);
});
Paul,
Yep you can continue to use the same key, and you'll want to https://node01.public.learningregistry.net/publish for the url rather than https://node01.public.
learningregistry.net/.
For the payload we're asking people to use a machine readable format based off of microdata, LRMI and JSON.
Here is an example we created from Khan Academy's API
{
"items": [
{
"type": [
"http://schema.org/CreativeWork"
<target name="cleanCTS">
<delete includeEmptyDirs="true" quiet="true">
<fileset dir="${ccHome}\software_development\build" />
<fileset dir="${ccHome}\software_development\build\classes\org\adl\samplerte\util" >
<exclude name="LMSDBHandler.class" />
</fileset>
<fileset dir="${lib}">
<exclude name="bsf.jar" />
<exclude name="java40.jar" />
<exclude name="joda-time-1.1.jar" />
var x=5;