Skip to content

Commit

Permalink
Add deprecation warnings to resizer and thumbnail URL generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Larralde committed Jan 22, 2018
1 parent 28adfe9 commit 9213151
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions instaLooter/urlgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from __future__ import unicode_literals

import re
import warnings

__all__ = ["default", "resizer", "thumbnail"]

Expand All @@ -36,6 +37,7 @@ def resizer(size):
dimensions of the picture will equal to ``size`` once it
is transformed.
"""
warnings.warn("`resizer` is not supported anymore", DeprecationWarning)
target = 's{0}x{0}/'.format(size)
def resize(media):
return RESIZER_RX.sub(target, media['display_src'])
Expand All @@ -46,6 +48,7 @@ def resize(media):
def thumbnail(media):
"""Generates a link to the thumbnail.
"""
warnings.warn("`thumbnail` is not supported anymore", DeprecationWarning)
try:
return media['thumbnail_src']
except KeyError:
Expand Down
2 changes: 2 additions & 0 deletions tests/test_urlgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def setUp(self):
def tearDown(self):
shutil.rmtree(self.tmpdir)

@unittest.expectedFailure
def test_resizer(self):
self.looter = instaLooter.InstaLooter(
self.tmpdir, url_generator=resizer(320), profile="instagram"
Expand All @@ -34,6 +35,7 @@ def test_resizer(self):
width, height = img.size
self.assertEqual(max(width, height), 320)

@unittest.expectedFailure
def test_thumbnail(self):
self.looter = instaLooter.InstaLooter(
self.tmpdir, url_generator=thumbnail, profile="therock"
Expand Down

0 comments on commit 9213151

Please sign in to comment.