Fix forced 30x resolution in https://github.com/jkehler/unshortenit/issues/26, add minor logging and exceptions#27
Fix forced 30x resolution in https://github.com/jkehler/unshortenit/issues/26, add minor logging and exceptions#27fake-name wants to merge 15 commits intojkehler:masterfrom
Conversation
# Conflicts: # setup.py
…ve them separate.
|
Note that I generally have fairly verbose logging, and it might be worth replacing all the log.info calls with log.debug, if you prefer the library to be more silent. |
|
Additional stupid junk: You can now provide a dict-like object to the UnshortenIt() instance, and it will then use that to allow you to provide already-resolved urls. This was done for my use case where I have some inputs that consume RSS feeds, and the RSS feeds contain shortened links. Due to the nature of RSS, I see the same posts fairly repeatedly, and waiting for them to resolve again, and again, and again..... This way, I can provide a custom dict-like object that saves the seen URLs in a database. The end result is a feed where I previously took > 5 minutes to process the contained links now takes ~5 seconds. I don't know why the pypy test is failing. It works in my local pypy3 install. Are the tests accidentally using pypy2? |
Push the caching up one layer so it's much more sensibly located. Add a flag that lets you forcibly ignore the cache entirely.
… modified. Instead, only do the cache query if we think we need to actually modify the link.
Principally, this fixes #26.
It also adds some simple logging (at the path "Main.LinkUnshortener"), and also imports the two exceptions into the
__init__.pyfile. This makes it much nicer to use, since you no longer need two separate imports if you want to catch exceptions.You can now do: