1,141 reputation
88
bio website
location St. Andrews, United Kingdom
age 18
visits member for 5 years, 1 month
seen Jun 15 at 4:50

Maths student at St Andrews University, Scotland. Hobbyist programmer. I dabble in a few languages; mainly Python and C at the minute.


May
11
comment Py-StackExchange: An API wrapper for Python
OK. The behaviour of the iterators changed recently. Site.questions.no_answers, Site.questions.recent_questions and Site.questions.unanswered will go on forever. The pagesize= argument actually tells the API how many items to return on each iteration - it will just keep iterating until it's returned all the pages. I agree this is not the most useful behaviour for this case, and I'm now planning to add a cleaner interface. For now, though, change your loop to for qq in ii(...).items, which will only iterate through the questions on the first page, of size pagesize.
May
7
comment Py-StackExchange: An API wrapper for Python
I have a feeling I may have fixed this bug in the latest version of the code, but that I haven't pushed it to PyPI. I'll try and push the latest code up; in the meantime you can get it straight from the repository at github.com/lucjon/Py-StackExchange.
Apr
12
comment Py-StackExchange: An API wrapper for Python
@systempuntoot: Thanks for the comment; it arrived in my inbox and reminded me I've not finished updating it yet! There is a branch on Github I started a while ago with some basic things working... I'll try and get that finished as soon as I can.
Jan
7
comment Py-StackExchange: An API wrapper for Python
Currently, keyword arguments are effectively passed verbatim to the API (albeit with a bit of processing to make them work in a URL). The best documentation I can offer in that regard are the official API docs. Regarding your second question: unfortunately, the current version of the API (v1.1) and the next planned version (v2.0) are read-only; you won't be able to star questions, although I think v2.0 will provide authentication functionality.
Aug
14
awarded  Favorite Question
Jun
10
comment Py-StackExchange: An API wrapper for Python
Ahem. Revisited this, doing browser testing. The reason from_date and to_date work is that they are ignored. Compare the total field on api.stackoverflow.com/1.1/… to api.stackoverflow.com/1.1/…. Either way, you can pass in a float if you want now; in the latest revision it'll be appropriately converted behind-the-scenes.
Jun
10
revised Py-StackExchange: An API wrapper for Python
added 208 characters in body
Jun
9
comment Py-StackExchange: An API wrapper for Python
Unfortunately, about all you can do is pass pagesize=100 to Site.questions. You can then use the methods on the returned resultset to advance through the pages. You won't be able to get anything bigger than 100 at a time, though. There are a couple of other options: you could try and export results from data.stackexchange.com, but those will probably be size-limited too. 'Worst case', you could download the data dump, but it's rather large (multi-gigabyte range) and hard to deal with.
May
25
comment Py-StackExchange: An API wrapper for Python
I'll double-check this, but unaccepted_questions is probably one of the fields that is not fetched automatically; instead use ii.get_user().unaccepted_questions.fetch().count. I know this is a little clunky, but otherwise it would need to pull in tonnes of data each request.
May
23
awarded  Yearling
May
18
comment Py-StackExchange: An API wrapper for Python
@LarsH: That's a good idea; it'll also encourage me to keep as close to 100% coverage as is humanly possible!
May
18
comment Py-StackExchange: An API wrapper for Python
Note to future readers: a nicer API is supported in v1.1: site.questions.by_user(uid).
May
18
comment Py-StackExchange: An API wrapper for Python
Doing some testing... strange: with from_date=aWhileAgo and to_date=currentDate it works, as it does with fromdate=int(aWhileAgo) and todate. But using a float as fromdate (as aWhileAgo was), which is formatted with a trailing .0 fails with error 500. So both work with integers; this might be an API inconsistency.
May
18
comment Py-StackExchange: An API wrapper for Python
While I'm here, I'll try putting in some more descriptive exceptions, too.
May
18
revised Py-StackExchange: An API wrapper for Python
added 134 characters in body
May
18
comment Py-StackExchange: An API wrapper for Python
@LarsH: That, and the wiki (also on Github). Will clarify.
May
18
comment Py-StackExchange: An API wrapper for Python
Hello; sorry for the delay, glad you solved your problem. To answer your first question, you can turn on debug printing of URLs by setting stackexchange.web.WebRequestManager.debug = True. I agree that the documentation in that area is lacking; a wiki page is coming up. I'll look into that inconsistency; it seems quite pointless... I apologise on behalf of my younger self.
May
4
comment Py-StackExchange: An API wrapper for Python
Sorry for the delay - OpenID/hosting problems... Anyway, doing some testing, I noticed that Django view parameters are Unicode strings. I hadn't thought to have handled Unicode explicitly in the library, and it turned out that the urllib module encodes it as UTF-16 by default, which the API (understandably) doesn't like. I've changed it to UTF-8, which now works under Django for me. Summary: update to the latest version in the Git repo. (Or, I can push a new release of the egg out if necessary.)
May
4
comment Py-StackExchange: An API wrapper for Python
Not as far as I know, unless you use client-side JavaScript or something like that to fetch the result. You'll probably be fine with a single key, with an increased quota if necessary. The SO team are very approachable ;).
May
2
awarded  Notable Question