esgibter / fandomstats

Fandom Statistics
12 stars 2 forks source link

Problem with API parameters - redirection? #45

Closed annathecrow closed 9 years ago

annathecrow commented 9 years ago

I wanted to work on the additional search filters, but I'm having a problem with the API - it doesn't seem to take any other parameters but the tag. I remember this used to work, and as far as I can tell from the code it's supposed to work... but it doesn't. Also, when I looked at the console I'm running the app from, there are some really weird things going on:

INFO     2015-06-20 12:51:21,869 module.py:737] default: "GET /api/v1.0/stats?tag_id=Imperator+Furiosa HTTP/1.1" 200 1531
INFO     2015-06-20 12:54:14,361 poolmanager.py:173] Redirecting http://archiveofourown.org/works?page=1&sort_direction=asc&tag_id=Imperator+Furiosa&work_search%5Btitle%5D=Rig&work_search%5Bcreator%5D=hellkity -> http://archiveofourown.org/tags/Furiosa%20(Mad%20Max)/works

Gist with the log of several more GET calls.) Notice how the poolmanager.py seems to be using params from previous queries. Do we use caching? And that query we're trying to fetch is wrong, or at least AO3 thinks it is. I don't know what's going on...

annathecrow commented 9 years ago

Okay, so, more info (just 7 minutes later, because of course):

  1. problem: I'm a dunce, AO3 tag search doesn't take neither "title" nor "creator" as a parameter.
  2. problem: queries are getting cached (or what), so even if I'm using valid params, the call is still using the invalid ones too.
  3. problem: it seems that non-canonical tag values get redirected but without keeping the tags. Which means that passing tag_id=Furiosa&complete=0 would return stats for Furiosa (Mad Max), but without filtering on completeness.

tl;dr we should definitely fix 2., but I'm not sure if we can do anything with 3. Well, technically, the app does know where it gets redirected, so maybe we could get the canonical tag that way? But can we get to that info, or is that too deep inside Flask/appengine?

annathecrow commented 9 years ago

I decided to split this into two separate issues:

46 - urllib3.poolmanager making calls using wrong GET parameters

47 - redirection to canonical tag url loses additional search parameters

continuing there.