esgibter / fandomstats

Fandom Statistics
12 stars 2 forks source link

redirection to canonical tag url loses additional search parameters #47

Closed annathecrow closed 8 years ago

annathecrow commented 9 years ago

API call /api/v1.0/stats?tag_id=Imperator+Furiosa&complete=1 is redirected to http://archiveofourown.org/tags/Furiosa%20(Mad%20Max)/works; numworks: 414. API call http://localhost:8080/api/v1.0/stats?tag_id=Furiosa+%28Mad+Max%29&complete=1 goes where it should; numworks: 287.

If nothing else, we need an error message; better yet, get the canonical tag from the url being redirected to, and re-run the call.

annathecrow commented 9 years ago

What I found so far: according to the documentation for urllib3, it should be possible to get the final redirection url, but it just wouldn't work for me. What did work was to add parameter "redirect=false" to request(), and then get the final destination from http headers. I think that will work too, since we need to re-run with the proper url anyway. Next question is, how to restructure the try-catch block, how to make the new url, and how to repeat the call with the new one.

Could we maybe we could "mirror" the tag aliases on our side, so we could tax the ao3 server less?

(relevant commit: 6c375a7424e723dd3416430448ba7ecd03732b2e)

annathecrow commented 9 years ago

(more info on the Redirection pull request, #50)

annathecrow commented 8 years ago

fixed in #50.