bibanon / BASC-py4chan

Python wrapper for 4chan API. The BA's vastly improved fork of Edgeworth's original.
http://basc-py4chan.readthedocs.org/en/latest/index.html
Do What The F*ck You Want To Public License
55 stars 13 forks source link

New URL Class for increased extendability #6

Closed antonizoon closed 9 years ago

antonizoon commented 9 years ago

I wrote up a new Url class, which puts all 4chan API URLs in one handy place. This way, URL construction is done in this class and can be easily reused. In fact, it might be helpful to use in our BASC-Archiver.

This replaces the limited URL dictionary.

A Url Class also makes it possible for derived classes to inherit and override the typical 4chan API URL settings, so 8chan/vichan or 420chan (which have similar APIs) can be supported by just tweaking the URLs a bit.

This way, we can create a possible py8chan or py420chan with a few overrides, and reduce code redundancy.