# Path: duckpond/apps/editor/app.py
# def before_request():


import requests
import json
import shutil
from tempfile import TemporaryFile
from flask import session, abort
from .app import app
      'genre' : genre,
      'name' : name,
      'headline' : headline
   }
   response = requests.post(url,auth=getAuth(),data=json.dumps(data),headers=headers)
   if response.status_code!=201:
      return (response.status_code,None,None)
   else:
      return (response.status_code,response.headers['Location'],response.headers['Date-Modified'])

def deleteContent(id):
   url = app.config['SERVICE'] + 'content/' + id + '/'
   response = requests.delete(url,auth=getAuth(),headers={'Connection' : 'close'})
   return response.status_code

def getContent(id):
   url = app.config['SERVICE'] + 'content/' + id + '/'
   response = requests.get(url,auth=getAuth(),headers={'Connection' : 'close'})
   if response.status_code==200:
      return json.loads(response.text)
   else:
      raise IOError('Cannot get content {id} from service, status {status}'.format(**{'status':response.status_code,'id':id}))

def updateContent(id,data):
   url = app.config['SERVICE'] + 'content/' + id + '/'
   headers = {'Content-Type' : 'application/ld+json', 'Connection' : 'close'}
   response = requests.put(url,auth=getAuth(),data=json.dumps(data),headers=headers)
   return (response.status_code,response.iter_content(chunk_size=10*1024),response.headers.get('content-type'))

def getContentResource(id,name):

# Path: duckpond/apps/editor/app.py
# def before_request():


# Path: duckpond/apps/editor/model.py
import requests
import json
import shutil
from tempfile import TemporaryFile
from flask import session, abort
from .app import app

      'genre' : genre,
      'name' : name,
      'headline' : headline
   }
   response = requests.post(url,auth=getAuth(),data=json.dumps(data),headers=headers)
   if response.status_code!=201:
      return (response.status_code,None,None)
   else:
      return (response.status_code,response.headers['Location'],response.headers['Date-Modified'])

def deleteContent(id):
   url = app.config['SERVICE'] + 'content/' + id + '/'
   response = requests.delete(url,auth=getAuth(),headers={'Connection' : 'close'})
   return response.status_code

def getContent(id):
   url = app.config['SERVICE'] + 'content/' + id + '/'
   response = requests.get(url,auth=getAuth(),headers={'Connection' : 'close'})
   if response.status_code==200:
      return json.loads(response.text)
   else:
      raise IOError('Cannot get content {id} from service, status {status}'.format(**{'status':response.status_code,'id':id}))

def updateContent(id,data):
   url = app.config['SERVICE'] + 'content/' + id + '/'
   headers = {'Content-Type' : 'application/ld+json', 'Connection' : 'close'}
   response = requests.put(url,auth=getAuth(),data=json.dumps(data),headers=headers)
   return (response.status_code,response.iter_content(chunk_size=10*1024),response.headers.get('content-type'))

def getContentResource(id,name):

   url = app.config['SERVICE'] + 'content/' + id + '/' + name