{"action":"created","comment":{"url":"https://api.github.com/repos/lsst/imgserv/pulls/comments/25042066","id":25042066,"diff_hunk":"@@ -0,0 +1,105 @@\n+#!/usr/bin/python\n+\n+# LSST Data Management System\n+# Copyright 2015 AURA/LSST.\n+#\n+# This product includes software developed by the\n+# LSST Project (http://www.lsst.org/).\n+#\n+# This program is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation, either version 3 of the License, or\n+# (at your option) any later version.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the LSST License Statement and\n+# the GNU General Public License along with this program.  If not,\n+# see <http://www.lsstcorp.org/LegalNotices/>.\n+\n+\"\"\"\n+This module implements the RESTful interface for Image Cutout Service.\n+Corresponding URI: /image\n+\n+@author  Jacek Becla, SLAC\n+\"\"\"\n+import os\n+import uuid\n+\n+from flask import Blueprint, Flask, make_response, request\n+\n+from lsst.imgserv.locateImage import dbOpen\n+\n+imageREST = Blueprint('imageREST', __name__, template_folder='imgserv')\n+\n+# this will eventually print list of supported versions\n+@imageREST.route('/')\n+def index():\n+    return \"\"\"\n+Hello, LSST Image Cutout Service here. Try something like:<br />\n+/image/v0/raw?ra=1&dec=1&filter=r<br />\n+/image/v0/raw/cutout?ra=1&dec=1&filter=r&width=12&height=12\n+\"\"\"\n+\n+\n+# this will handle something like:\n+# GET /image/v0/raw?ra=1&dec=1&filter=r\n+@imageREST.route('/raw', methods=['GET'])\n+def getRaw():\n+    ra = request.args.get('ra', '1')\n+    dec = request.args.get('dec', '1')\n+    filter = request.args.get('filter', 'r')\n+\n+    # fetch the image here\n+    # TODO - check inputs are valid.\n+    ra = float(ra)\n+    dec = float(dec)\n+    print \"raw ra={} dec={} filter={}\".format(ra, dec, filter)\n+    # fetch the image here\n+    w13Raw = dbOpen(\"~/.lsst/dbAuth-dbServ.txt\")\n+    imgFull = w13Raw.getImageFull(ra, dec)","path":"python/lsst/imgserv/imageREST_v0.py","position":63,"original_position":63,"commit_id":"e4f2d5527ab78024ef266624851e9f56eca81987","original_commit_id":"e4f2d5527ab78024ef266624851e9f56eca81987","user":{"login":"andy-slac","id":4266950,"avatar_url":"https://avatars.githubusercontent.com/u/4266950?v=3","gravatar_id":"","url":"https://api.github.com/users/andy-slac","html_url":"https://github.com/andy-slac","followers_url":"https://api.github.com/users/andy-slac/followers","following_url":"https://api.github.com/users/andy-slac/following{/other_user}","gists_url":"https://api.github.com/users/andy-slac/gists{/gist_id}","starred_url":"https://api.github.com/users/andy-slac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andy-slac/subscriptions","organizations_url":"https://api.github.com/users/andy-slac/orgs","repos_url":"https://api.github.com/users/andy-slac/repos","events_url":"https://api.github.com/users/andy-slac/events{/privacy}","received_events_url":"https://api.github.com/users/andy-slac/received_events","type":"User","site_admin":false},"body":"OK, I was thinking more about what happens when `imgFull` is `None`, the code below will raise an exception which probably return something like \"ERROR 500\" on the client side. Anyways, I'm happy we have a ticket already to take care of that :)","created_at":"2015-02-20T00:57:00Z","updated_at":"2015-02-20T00:57:00Z","html_url":"https://github.com/lsst/imgserv/pull/2#discussion_r25042066","pull_request_url":"https://api.github.com/repos/lsst/imgserv/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/lsst/imgserv/pulls/comments/25042066"},"html":{"href":"https://github.com/lsst/imgserv/pull/2#discussion_r25042066"},"pull_request":{"href":"https://api.github.com/repos/lsst/imgserv/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/lsst/imgserv/pulls/2","id":29642905,"html_url":"https://github.com/lsst/imgserv/pull/2","diff_url":"https://github.com/lsst/imgserv/pull/2.diff","patch_url":"https://github.com/lsst/imgserv/pull/2.patch","issue_url":"https://api.github.com/repos/lsst/imgserv/issues/2","number":2,"state":"open","locked":false,"title":"u/jbecla/dm-1627","user":{"login":"andy-slac","id":4266950,"avatar_url":"https://avatars.githubusercontent.com/u/4266950?v=3","gravatar_id":"","url":"https://api.github.com/users/andy-slac","html_url":"https://github.com/andy-slac","followers_url":"https://api.github.com/users/andy-slac/followers","following_url":"https://api.github.com/users/andy-slac/following{/other_user}","gists_url":"https://api.github.com/users/andy-slac/gists{/gist_id}","starred_url":"https://api.github.com/users/andy-slac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andy-slac/subscriptions","organizations_url":"https://api.github.com/users/andy-slac/orgs","repos_url":"https://api.github.com/users/andy-slac/repos","events_url":"https://api.github.com/users/andy-slac/events{/privacy}","received_events_url":"https://api.github.com/users/andy-slac/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-02-19T19:51:28Z","updated_at":"2015-02-20T00:57:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"da61649546c218f5f950fdb5d99dfbab7667c879","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/lsst/imgserv/pulls/2/commits","review_comments_url":"https://api.github.com/repos/lsst/imgserv/pulls/2/comments","review_comment_url":"https://api.github.com/repos/lsst/imgserv/pulls/comments/{number}","comments_url":"https://api.github.com/repos/lsst/imgserv/issues/2/comments","statuses_url":"https://api.github.com/repos/lsst/imgserv/statuses/e4f2d5527ab78024ef266624851e9f56eca81987","head":{"label":"u/jbecla/DM-1627","ref":"u/jbecla/DM-1627","sha":"e4f2d5527ab78024ef266624851e9f56eca81987","user":{"login":"lsst","id":1134504,"avatar_url":"https://avatars.githubusercontent.com/u/1134504?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst","html_url":"https://github.com/lsst","followers_url":"https://api.github.com/users/lsst/followers","following_url":"https://api.github.com/users/lsst/following{/other_user}","gists_url":"https://api.github.com/users/lsst/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst/subscriptions","organizations_url":"https://api.github.com/users/lsst/orgs","repos_url":"https://api.github.com/users/lsst/repos","events_url":"https://api.github.com/users/lsst/events{/privacy}","received_events_url":"https://api.github.com/users/lsst/received_events","type":"Organization","site_admin":false},"repo":{"id":30268942,"name":"imgserv","full_name":"lsst/imgserv","owner":{"login":"lsst","id":1134504,"avatar_url":"https://avatars.githubusercontent.com/u/1134504?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst","html_url":"https://github.com/lsst","followers_url":"https://api.github.com/users/lsst/followers","following_url":"https://api.github.com/users/lsst/following{/other_user}","gists_url":"https://api.github.com/users/lsst/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst/subscriptions","organizations_url":"https://api.github.com/users/lsst/orgs","repos_url":"https://api.github.com/users/lsst/repos","events_url":"https://api.github.com/users/lsst/events{/privacy}","received_events_url":"https://api.github.com/users/lsst/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lsst/imgserv","description":"Web Interface for LSST Image Services","fork":false,"url":"https://api.github.com/repos/lsst/imgserv","forks_url":"https://api.github.com/repos/lsst/imgserv/forks","keys_url":"https://api.github.com/repos/lsst/imgserv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lsst/imgserv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lsst/imgserv/teams","hooks_url":"https://api.github.com/repos/lsst/imgserv/hooks","issue_events_url":"https://api.github.com/repos/lsst/imgserv/issues/events{/number}","events_url":"https://api.github.com/repos/lsst/imgserv/events","assignees_url":"https://api.github.com/repos/lsst/imgserv/assignees{/user}","branches_url":"https://api.github.com/repos/lsst/imgserv/branches{/branch}","tags_url":"https://api.github.com/repos/lsst/imgserv/tags","blobs_url":"https://api.github.com/repos/lsst/imgserv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lsst/imgserv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lsst/imgserv/git/refs{/sha}","trees_url":"https://api.github.com/repos/lsst/imgserv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lsst/imgserv/statuses/{sha}","languages_url":"https://api.github.com/repos/lsst/imgserv/languages","stargazers_url":"https://api.github.com/repos/lsst/imgserv/stargazers","contributors_url":"https://api.github.com/repos/lsst/imgserv/contributors","subscribers_url":"https://api.github.com/repos/lsst/imgserv/subscribers","subscription_url":"https://api.github.com/repos/lsst/imgserv/subscription","commits_url":"https://api.github.com/repos/lsst/imgserv/commits{/sha}","git_commits_url":"https://api.github.com/repos/lsst/imgserv/git/commits{/sha}","comments_url":"https://api.github.com/repos/lsst/imgserv/comments{/number}","issue_comment_url":"https://api.github.com/repos/lsst/imgserv/issues/comments/{number}","contents_url":"https://api.github.com/repos/lsst/imgserv/contents/{+path}","compare_url":"https://api.github.com/repos/lsst/imgserv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lsst/imgserv/merges","archive_url":"https://api.github.com/repos/lsst/imgserv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lsst/imgserv/downloads","issues_url":"https://api.github.com/repos/lsst/imgserv/issues{/number}","pulls_url":"https://api.github.com/repos/lsst/imgserv/pulls{/number}","milestones_url":"https://api.github.com/repos/lsst/imgserv/milestones{/number}","notifications_url":"https://api.github.com/repos/lsst/imgserv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lsst/imgserv/labels{/name}","releases_url":"https://api.github.com/repos/lsst/imgserv/releases{/id}","created_at":"2015-02-03T22:50:07Z","updated_at":"2015-02-13T00:06:54Z","pushed_at":"2015-02-18T18:40:10Z","git_url":"git://github.com/lsst/imgserv.git","ssh_url":"git@github.com:lsst/imgserv.git","clone_url":"https://github.com/lsst/imgserv.git","svn_url":"https://github.com/lsst/imgserv","homepage":"http://dm.lsst.org/","size":1268,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"master","ref":"master","sha":"69c95d05aa7f87d2d3eed5188f8eb9608c472756","user":{"login":"lsst","id":1134504,"avatar_url":"https://avatars.githubusercontent.com/u/1134504?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst","html_url":"https://github.com/lsst","followers_url":"https://api.github.com/users/lsst/followers","following_url":"https://api.github.com/users/lsst/following{/other_user}","gists_url":"https://api.github.com/users/lsst/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst/subscriptions","organizations_url":"https://api.github.com/users/lsst/orgs","repos_url":"https://api.github.com/users/lsst/repos","events_url":"https://api.github.com/users/lsst/events{/privacy}","received_events_url":"https://api.github.com/users/lsst/received_events","type":"Organization","site_admin":false},"repo":{"id":30268942,"name":"imgserv","full_name":"lsst/imgserv","owner":{"login":"lsst","id":1134504,"avatar_url":"https://avatars.githubusercontent.com/u/1134504?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst","html_url":"https://github.com/lsst","followers_url":"https://api.github.com/users/lsst/followers","following_url":"https://api.github.com/users/lsst/following{/other_user}","gists_url":"https://api.github.com/users/lsst/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst/subscriptions","organizations_url":"https://api.github.com/users/lsst/orgs","repos_url":"https://api.github.com/users/lsst/repos","events_url":"https://api.github.com/users/lsst/events{/privacy}","received_events_url":"https://api.github.com/users/lsst/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lsst/imgserv","description":"Web Interface for LSST Image Services","fork":false,"url":"https://api.github.com/repos/lsst/imgserv","forks_url":"https://api.github.com/repos/lsst/imgserv/forks","keys_url":"https://api.github.com/repos/lsst/imgserv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lsst/imgserv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lsst/imgserv/teams","hooks_url":"https://api.github.com/repos/lsst/imgserv/hooks","issue_events_url":"https://api.github.com/repos/lsst/imgserv/issues/events{/number}","events_url":"https://api.github.com/repos/lsst/imgserv/events","assignees_url":"https://api.github.com/repos/lsst/imgserv/assignees{/user}","branches_url":"https://api.github.com/repos/lsst/imgserv/branches{/branch}","tags_url":"https://api.github.com/repos/lsst/imgserv/tags","blobs_url":"https://api.github.com/repos/lsst/imgserv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lsst/imgserv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lsst/imgserv/git/refs{/sha}","trees_url":"https://api.github.com/repos/lsst/imgserv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lsst/imgserv/statuses/{sha}","languages_url":"https://api.github.com/repos/lsst/imgserv/languages","stargazers_url":"https://api.github.com/repos/lsst/imgserv/stargazers","contributors_url":"https://api.github.com/repos/lsst/imgserv/contributors","subscribers_url":"https://api.github.com/repos/lsst/imgserv/subscribers","subscription_url":"https://api.github.com/repos/lsst/imgserv/subscription","commits_url":"https://api.github.com/repos/lsst/imgserv/commits{/sha}","git_commits_url":"https://api.github.com/repos/lsst/imgserv/git/commits{/sha}","comments_url":"https://api.github.com/repos/lsst/imgserv/comments{/number}","issue_comment_url":"https://api.github.com/repos/lsst/imgserv/issues/comments/{number}","contents_url":"https://api.github.com/repos/lsst/imgserv/contents/{+path}","compare_url":"https://api.github.com/repos/lsst/imgserv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lsst/imgserv/merges","archive_url":"https://api.github.com/repos/lsst/imgserv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lsst/imgserv/downloads","issues_url":"https://api.github.com/repos/lsst/imgserv/issues{/number}","pulls_url":"https://api.github.com/repos/lsst/imgserv/pulls{/number}","milestones_url":"https://api.github.com/repos/lsst/imgserv/milestones{/number}","notifications_url":"https://api.github.com/repos/lsst/imgserv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lsst/imgserv/labels{/name}","releases_url":"https://api.github.com/repos/lsst/imgserv/releases{/id}","created_at":"2015-02-03T22:50:07Z","updated_at":"2015-02-13T00:06:54Z","pushed_at":"2015-02-18T18:40:10Z","git_url":"git://github.com/lsst/imgserv.git","ssh_url":"git@github.com:lsst/imgserv.git","clone_url":"https://github.com/lsst/imgserv.git","svn_url":"https://github.com/lsst/imgserv","homepage":"http://dm.lsst.org/","size":1268,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lsst/imgserv/pulls/2"},"html":{"href":"https://github.com/lsst/imgserv/pull/2"},"issue":{"href":"https://api.github.com/repos/lsst/imgserv/issues/2"},"comments":{"href":"https://api.github.com/repos/lsst/imgserv/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/lsst/imgserv/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/lsst/imgserv/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/lsst/imgserv/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/lsst/imgserv/statuses/e4f2d5527ab78024ef266624851e9f56eca81987"}}}}