Browse Source

Added further commentary.

Sam Flint 10 years ago
parent
commit
bac4d1464c
1 changed files with 7 additions and 1 deletions
  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>>
 #+end_src
 #+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
 First, we need to construct the query URL.
 #+Name: ConstructURL
 #+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
 #+end_src
 #+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
 We also have to actually query the server, this is simple, especially since we want our data.