Skip to content

Commit

Permalink
Updated registering module
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Mahn committed Sep 23, 2016
1 parent 585cfd0 commit 481b3dc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
22 changes: 8 additions & 14 deletions functions/register/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,20 @@
# Method for registering this module

from __future__ import print_function, unicode_literals

import requests
import json
import os


def handle(event, ctx):
if not 'api_url' in event:
raise Exception("'api_url' not in payload")

post_url = event['api_url']+'/rich-tx/module'
post_data = {
"name": "tx-md2html_convert",
"version": "1",
"type": "conversion",
"resource_types": ["obs"],
"input_format": ["md"],
"output_format": ["html"],
"options": [],
"private_links": [],
"public_links": []
}

response = requests.post(post_url, data=post_data, headers={'content-type': 'application/json'})
with open('module.json') as data_file:
data = json.load(data_file)

url = event['api_url']+'/tx/module'

response = requests.post(url, data=data, headers={'content-type': 'application/json'})
return json.loads(response.text)
3 changes: 2 additions & 1 deletion functions/register/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
requests
boto3
boto3

Empty file modified register_module.sh
100644 → 100755
Empty file.

0 comments on commit 481b3dc

Please sign in to comment.