{"action":"created","comment":{"url":"https://api.github.com/repos/cshinaver/BookFinder/pulls/comments/43711066","id":43711066,"diff_hunk":"@@ -0,0 +1,106 @@\n+from flask import render_template, request\n+\n+from bookfinder import app\n+from bookfinder.db.connect import execute_sql_query\n+from bookfinder.models.book import Book\n+from bookfinder.models.purchasechoice import PurchaseChoice\n+\n+import json\n+from scraper import get_book_object_list_for_book_title, get_amazon_books_for_keyword, get_Barnes_book_prices_for_isbn, get_google_books_for_isbn\n+\n+\n+@app.route('/api/books_list/')\n+def book_query():\n+    title = request.args.get('title')\n+    book_list = []\n+    for book in get_book_object_list_for_book_title(title):\n+        book_list.append(book.to_dict())\n+    json_output = json.dumps(book_list, sort_keys=True, indent=4)\n+    return json_output\n+\n+\n+@app.route('/api/used_option_list/')\n+def used_option_query():\n+    def get_list_by_isbn(isbn):\n+        def fill_list_by_bookid(option_list,book_id):\n+            def add_to_list(list,option):\n+                list.append({\n+                    'seller': option.seller,\n+                    'price': option.price,\n+                    'rental': option.isRental,\n+                    'book_type': option.type,\n+                    'link': option.link,\n+                    'purchaseID': option.id\n+                })\n+                return list\n+            \n+            query_return = PurchaseChoice().get(book_id=book_id)\n+            if isinstance(book_query,list):\n+                for option in query_return:\n+                    option_list = add_to_list(option_list,option)\n+            else:\n+                option_list = add_to_list(option_list,query_return)\n+            return option_list\n+        \n+        book_query = Book().get(isbn=isbn)\n+        if book_query is None:#return blank list if this book is not yet in the database\n+            option_list = []\n+        elif isinstance(book_query,list):\n+            print 'WARNING: There are multiple books with ISBN {isbn}'.format(isbn=isbn)","path":"bookfinder/api/views.py","position":49,"original_position":49,"commit_id":"aad78884ed0bbe9035cfaaeac83b34a274439773","original_commit_id":"aad78884ed0bbe9035cfaaeac83b34a274439773","user":{"login":"cshinaver","id":7769334,"avatar_url":"https://avatars.githubusercontent.com/u/7769334?v=3","gravatar_id":"","url":"https://api.github.com/users/cshinaver","html_url":"https://github.com/cshinaver","followers_url":"https://api.github.com/users/cshinaver/followers","following_url":"https://api.github.com/users/cshinaver/following{/other_user}","gists_url":"https://api.github.com/users/cshinaver/gists{/gist_id}","starred_url":"https://api.github.com/users/cshinaver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cshinaver/subscriptions","organizations_url":"https://api.github.com/users/cshinaver/orgs","repos_url":"https://api.github.com/users/cshinaver/repos","events_url":"https://api.github.com/users/cshinaver/events{/privacy}","received_events_url":"https://api.github.com/users/cshinaver/received_events","type":"User","site_admin":false},"body":"Remove print ","created_at":"2015-11-03T02:33:48Z","updated_at":"2015-11-03T02:33:48Z","html_url":"https://github.com/cshinaver/BookFinder/pull/30#discussion_r43711066","pull_request_url":"https://api.github.com/repos/cshinaver/BookFinder/pulls/30","_links":{"self":{"href":"https://api.github.com/repos/cshinaver/BookFinder/pulls/comments/43711066"},"html":{"href":"https://github.com/cshinaver/BookFinder/pull/30#discussion_r43711066"},"pull_request":{"href":"https://api.github.com/repos/cshinaver/BookFinder/pulls/30"}}},"pull_request":{"url":"https://api.github.com/repos/cshinaver/BookFinder/pulls/30","id":48774357,"html_url":"https://github.com/cshinaver/BookFinder/pull/30","diff_url":"https://github.com/cshinaver/BookFinder/pull/30.diff","patch_url":"https://github.com/cshinaver/BookFinder/pull/30.patch","issue_url":"https://api.github.com/repos/cshinaver/BookFinder/issues/30","number":30,"state":"open","locked":false,"title":"Home Page with searching","user":{"login":"cshinaver","id":7769334,"avatar_url":"https://avatars.githubusercontent.com/u/7769334?v=3","gravatar_id":"","url":"https://api.github.com/users/cshinaver","html_url":"https://github.com/cshinaver","followers_url":"https://api.github.com/users/cshinaver/followers","following_url":"https://api.github.com/users/cshinaver/following{/other_user}","gists_url":"https://api.github.com/users/cshinaver/gists{/gist_id}","starred_url":"https://api.github.com/users/cshinaver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cshinaver/subscriptions","organizations_url":"https://api.github.com/users/cshinaver/orgs","repos_url":"https://api.github.com/users/cshinaver/repos","events_url":"https://api.github.com/users/cshinaver/events{/privacy}","received_events_url":"https://api.github.com/users/cshinaver/received_events","type":"User","site_admin":false},"body":"- [x] Create home page with search bar (preferably using a template for design's sake)\r\nSearching functionality\r\n- [x] Searching queries database book information \r\n- [x] Searching starts data scraper and dynamically adds search results to page (will require JS) \r\n- [ ] Implement caching\r\n","created_at":"2015-10-26T17:56:14Z","updated_at":"2015-11-03T02:33:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4ce30460951f2574b01e80594d1024938ff2d346","assignee":{"login":"jhuseman","id":11066239,"avatar_url":"https://avatars.githubusercontent.com/u/11066239?v=3","gravatar_id":"","url":"https://api.github.com/users/jhuseman","html_url":"https://github.com/jhuseman","followers_url":"https://api.github.com/users/jhuseman/followers","following_url":"https://api.github.com/users/jhuseman/following{/other_user}","gists_url":"https://api.github.com/users/jhuseman/gists{/gist_id}","starred_url":"https://api.github.com/users/jhuseman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhuseman/subscriptions","organizations_url":"https://api.github.com/users/jhuseman/orgs","repos_url":"https://api.github.com/users/jhuseman/repos","events_url":"https://api.github.com/users/jhuseman/events{/privacy}","received_events_url":"https://api.github.com/users/jhuseman/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/cshinaver/BookFinder/pulls/30/commits","review_comments_url":"https://api.github.com/repos/cshinaver/BookFinder/pulls/30/comments","review_comment_url":"https://api.github.com/repos/cshinaver/BookFinder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cshinaver/BookFinder/issues/30/comments","statuses_url":"https://api.github.com/repos/cshinaver/BookFinder/statuses/aad78884ed0bbe9035cfaaeac83b34a274439773","head":{"label":"cshinaver:issue_28","ref":"issue_28","sha":"aad78884ed0bbe9035cfaaeac83b34a274439773","user":{"login":"cshinaver","id":7769334,"avatar_url":"https://avatars.githubusercontent.com/u/7769334?v=3","gravatar_id":"","url":"https://api.github.com/users/cshinaver","html_url":"https://github.com/cshinaver","followers_url":"https://api.github.com/users/cshinaver/followers","following_url":"https://api.github.com/users/cshinaver/following{/other_user}","gists_url":"https://api.github.com/users/cshinaver/gists{/gist_id}","starred_url":"https://api.github.com/users/cshinaver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cshinaver/subscriptions","organizations_url":"https://api.github.com/users/cshinaver/orgs","repos_url":"https://api.github.com/users/cshinaver/repos","events_url":"https://api.github.com/users/cshinaver/events{/privacy}","received_events_url":"https://api.github.com/users/cshinaver/received_events","type":"User","site_admin":false},"repo":{"id":42416214,"name":"BookFinder","full_name":"cshinaver/BookFinder","owner":{"login":"cshinaver","id":7769334,"avatar_url":"https://avatars.githubusercontent.com/u/7769334?v=3","gravatar_id":"","url":"https://api.github.com/users/cshinaver","html_url":"https://github.com/cshinaver","followers_url":"https://api.github.com/users/cshinaver/followers","following_url":"https://api.github.com/users/cshinaver/following{/other_user}","gists_url":"https://api.github.com/users/cshinaver/gists{/gist_id}","starred_url":"https://api.github.com/users/cshinaver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cshinaver/subscriptions","organizations_url":"https://api.github.com/users/cshinaver/orgs","repos_url":"https://api.github.com/users/cshinaver/repos","events_url":"https://api.github.com/users/cshinaver/events{/privacy}","received_events_url":"https://api.github.com/users/cshinaver/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cshinaver/BookFinder","description":"BookFinder","fork":false,"url":"https://api.github.com/repos/cshinaver/BookFinder","forks_url":"https://api.github.com/repos/cshinaver/BookFinder/forks","keys_url":"https://api.github.com/repos/cshinaver/BookFinder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cshinaver/BookFinder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cshinaver/BookFinder/teams","hooks_url":"https://api.github.com/repos/cshinaver/BookFinder/hooks","issue_events_url":"https://api.github.com/repos/cshinaver/BookFinder/issues/events{/number}","events_url":"https://api.github.com/repos/cshinaver/BookFinder/events","assignees_url":"https://api.github.com/repos/cshinaver/BookFinder/assignees{/user}","branches_url":"https://api.github.com/repos/cshinaver/BookFinder/branches{/branch}","tags_url":"https://api.github.com/repos/cshinaver/BookFinder/tags","blobs_url":"https://api.github.com/repos/cshinaver/BookFinder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cshinaver/BookFinder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cshinaver/BookFinder/git/refs{/sha}","trees_url":"https://api.github.com/repos/cshinaver/BookFinder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cshinaver/BookFinder/statuses/{sha}","languages_url":"https://api.github.com/repos/cshinaver/BookFinder/languages","stargazers_url":"https://api.github.com/repos/cshinaver/BookFinder/stargazers","contributors_url":"https://api.github.com/repos/cshinaver/BookFinder/contributors","subscribers_url":"https://api.github.com/repos/cshinaver/BookFinder/subscribers","subscription_url":"https://api.github.com/repos/cshinaver/BookFinder/subscription","commits_url":"https://api.github.com/repos/cshinaver/BookFinder/commits{/sha}","git_commits_url":"https://api.github.com/repos/cshinaver/BookFinder/git/commits{/sha}","comments_url":"https://api.github.com/repos/cshinaver/BookFinder/comments{/number}","issue_comment_url":"https://api.github.com/repos/cshinaver/BookFinder/issues/comments{/number}","contents_url":"https://api.github.com/repos/cshinaver/BookFinder/contents/{+path}","compare_url":"https://api.github.com/repos/cshinaver/BookFinder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cshinaver/BookFinder/merges","archive_url":"https://api.github.com/repos/cshinaver/BookFinder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cshinaver/BookFinder/downloads","issues_url":"https://api.github.com/repos/cshinaver/BookFinder/issues{/number}","pulls_url":"https://api.github.com/repos/cshinaver/BookFinder/pulls{/number}","milestones_url":"https://api.github.com/repos/cshinaver/BookFinder/milestones{/number}","notifications_url":"https://api.github.com/repos/cshinaver/BookFinder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cshinaver/BookFinder/labels{/name}","releases_url":"https://api.github.com/repos/cshinaver/BookFinder/releases{/id}","created_at":"2015-09-13T23:02:30Z","updated_at":"2015-10-11T18:22:25Z","pushed_at":"2015-11-03T01:53:35Z","git_url":"git://github.com/cshinaver/BookFinder.git","ssh_url":"git@github.com:cshinaver/BookFinder.git","clone_url":"https://github.com/cshinaver/BookFinder.git","svn_url":"https://github.com/cshinaver/BookFinder","homepage":"","size":844,"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":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"cshinaver:master","ref":"master","sha":"dacd9924aafc7966e874f7bc00a9121ae33a3d2d","user":{"login":"cshinaver","id":7769334,"avatar_url":"https://avatars.githubusercontent.com/u/7769334?v=3","gravatar_id":"","url":"https://api.github.com/users/cshinaver","html_url":"https://github.com/cshinaver","followers_url":"https://api.github.com/users/cshinaver/followers","following_url":"https://api.github.com/users/cshinaver/following{/other_user}","gists_url":"https://api.github.com/users/cshinaver/gists{/gist_id}","starred_url":"https://api.github.com/users/cshinaver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cshinaver/subscriptions","organizations_url":"https://api.github.com/users/cshinaver/orgs","repos_url":"https://api.github.com/users/cshinaver/repos","events_url":"https://api.github.com/users/cshinaver/events{/privacy}","received_events_url":"https://api.github.com/users/cshinaver/received_events","type":"User","site_admin":false},"repo":{"id":42416214,"name":"BookFinder","full_name":"cshinaver/BookFinder","owner":{"login":"cshinaver","id":7769334,"avatar_url":"https://avatars.githubusercontent.com/u/7769334?v=3","gravatar_id":"","url":"https://api.github.com/users/cshinaver","html_url":"https://github.com/cshinaver","followers_url":"https://api.github.com/users/cshinaver/followers","following_url":"https://api.github.com/users/cshinaver/following{/other_user}","gists_url":"https://api.github.com/users/cshinaver/gists{/gist_id}","starred_url":"https://api.github.com/users/cshinaver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cshinaver/subscriptions","organizations_url":"https://api.github.com/users/cshinaver/orgs","repos_url":"https://api.github.com/users/cshinaver/repos","events_url":"https://api.github.com/users/cshinaver/events{/privacy}","received_events_url":"https://api.github.com/users/cshinaver/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cshinaver/BookFinder","description":"BookFinder","fork":false,"url":"https://api.github.com/repos/cshinaver/BookFinder","forks_url":"https://api.github.com/repos/cshinaver/BookFinder/forks","keys_url":"https://api.github.com/repos/cshinaver/BookFinder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cshinaver/BookFinder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cshinaver/BookFinder/teams","hooks_url":"https://api.github.com/repos/cshinaver/BookFinder/hooks","issue_events_url":"https://api.github.com/repos/cshinaver/BookFinder/issues/events{/number}","events_url":"https://api.github.com/repos/cshinaver/BookFinder/events","assignees_url":"https://api.github.com/repos/cshinaver/BookFinder/assignees{/user}","branches_url":"https://api.github.com/repos/cshinaver/BookFinder/branches{/branch}","tags_url":"https://api.github.com/repos/cshinaver/BookFinder/tags","blobs_url":"https://api.github.com/repos/cshinaver/BookFinder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cshinaver/BookFinder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cshinaver/BookFinder/git/refs{/sha}","trees_url":"https://api.github.com/repos/cshinaver/BookFinder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cshinaver/BookFinder/statuses/{sha}","languages_url":"https://api.github.com/repos/cshinaver/BookFinder/languages","stargazers_url":"https://api.github.com/repos/cshinaver/BookFinder/stargazers","contributors_url":"https://api.github.com/repos/cshinaver/BookFinder/contributors","subscribers_url":"https://api.github.com/repos/cshinaver/BookFinder/subscribers","subscription_url":"https://api.github.com/repos/cshinaver/BookFinder/subscription","commits_url":"https://api.github.com/repos/cshinaver/BookFinder/commits{/sha}","git_commits_url":"https://api.github.com/repos/cshinaver/BookFinder/git/commits{/sha}","comments_url":"https://api.github.com/repos/cshinaver/BookFinder/comments{/number}","issue_comment_url":"https://api.github.com/repos/cshinaver/BookFinder/issues/comments{/number}","contents_url":"https://api.github.com/repos/cshinaver/BookFinder/contents/{+path}","compare_url":"https://api.github.com/repos/cshinaver/BookFinder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cshinaver/BookFinder/merges","archive_url":"https://api.github.com/repos/cshinaver/BookFinder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cshinaver/BookFinder/downloads","issues_url":"https://api.github.com/repos/cshinaver/BookFinder/issues{/number}","pulls_url":"https://api.github.com/repos/cshinaver/BookFinder/pulls{/number}","milestones_url":"https://api.github.com/repos/cshinaver/BookFinder/milestones{/number}","notifications_url":"https://api.github.com/repos/cshinaver/BookFinder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cshinaver/BookFinder/labels{/name}","releases_url":"https://api.github.com/repos/cshinaver/BookFinder/releases{/id}","created_at":"2015-09-13T23:02:30Z","updated_at":"2015-10-11T18:22:25Z","pushed_at":"2015-11-03T01:53:35Z","git_url":"git://github.com/cshinaver/BookFinder.git","ssh_url":"git@github.com:cshinaver/BookFinder.git","clone_url":"https://github.com/cshinaver/BookFinder.git","svn_url":"https://github.com/cshinaver/BookFinder","homepage":"","size":844,"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":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cshinaver/BookFinder/pulls/30"},"html":{"href":"https://github.com/cshinaver/BookFinder/pull/30"},"issue":{"href":"https://api.github.com/repos/cshinaver/BookFinder/issues/30"},"comments":{"href":"https://api.github.com/repos/cshinaver/BookFinder/issues/30/comments"},"review_comments":{"href":"https://api.github.com/repos/cshinaver/BookFinder/pulls/30/comments"},"review_comment":{"href":"https://api.github.com/repos/cshinaver/BookFinder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cshinaver/BookFinder/pulls/30/commits"},"statuses":{"href":"https://api.github.com/repos/cshinaver/BookFinder/statuses/aad78884ed0bbe9035cfaaeac83b34a274439773"}}}}