prints was replaced with logging; use urljoin instead of recreate urls from scratch; improved pythonic style