This is a Python library for accessing and retrieving links to comics from the
xkcd webcomic by Randall Munroe. It is NOT endorsed or made by him, it's an
entirely independent project.
It makes use of the JSON interface to Randall's site to retrieve comic data.
One can create comic objects manually using Comic(number), or can use the helper
functions provided- getLatestComic(), getRandomComic(), and getComic()- to do
this. Once you have a Comic object, you can access data from it using various
Released by Ben Rosser in 2012 under the MIT license (see below).
Github: Here. (Use to submit bugs, etc.)
This began as a Python script that was part of an IRC bot I created. I had added a command
(!xkcd) which would return the latest xkcd comic. Over time, the project expanded and I eventually
ended up releasing a library called 'xkcd' with some scripts to do silly things like get random
comics or download every comic on the site. At the time, I was using the RSS feed to the site,
but then I read something exhorting people to use the JSON access instead if they were writing scripts
to get data from the site.
So I modified it to use JSON, applied two+ years of Python experience that I'd accumulated
since first writing it, and now I'm releasing it as an independent project.
This module is now in PyPI, so the easiest way to install is to use pip (pip install xkcd). Alternatively, grab it from PyPI here.
Copyright (c) 2012 Ben Rosser
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.