浏览代码

Added further commentary.

Sam Flint 12 年之前
父节点
当前提交
bac4d1464c
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      isbn2BibTeX.org

+ 7 - 1
isbn2BibTeX.org

@@ -93,15 +93,21 @@ Well, here's the thing, this body needs a few things, but we have a single entry
           <<BibTeXOutput>>
           <<BibTeXOutput>>
 #+end_src
 #+end_src
 #+Caption: The Main Body of Code (Body)
 #+Caption: The Main Body of Code (Body)
+The first thing that we need to do is construct the query URL.  We then perform the query and parse the results.  from there we enter a for loop, grabbing items from the `data` key of the query as book, and creating a key, and outputting an entry if there is an `author_data` key in `book`.
 
 
 *** Construct query URL
 *** Construct query URL
 First, we need to construct the query URL.
 First, we need to construct the query URL.
 #+Name: ConstructURL
 #+Name: ConstructURL
 #+begin_src python
 #+begin_src python
-  query = urllib.quote_plus(sys.argv[1])
+  qstring = ""
+  for arg in sys.argv:
+      qstring = qstring . " " . arg
+  
+  query = urllib.quote_plus(qstring)
   queryURL = jsonreq + query
   queryURL = jsonreq + query
 #+end_src
 #+end_src
 #+Caption: Construct the query URL (ConstructURL)
 #+Caption: Construct the query URL (ConstructURL)
+So the first thing we do is to construct a single string from all of the arguments.  We than url encode it as `query`, tacking that on to `jsonreq` as `queryURL`.
 
 
 *** Query and Parse Response
 *** Query and Parse Response
 We also have to actually query the server, this is simple, especially since we want our data.
 We also have to actually query the server, this is simple, especially since we want our data.