Almouro / bitrise-giphy-step

Spice up your Bitrise.io logs with a random Gif from Giphy
http://bitrise.io
MIT License
1 stars 5 forks source link

ValueError, empty range for randrange() #6

Open jamieastley opened 4 years ago

jamieastley commented 4 years ago

Exception is being thrown when Bitrise step is executed.

Am using my own registered API key that returns results perfectly fine within Postman.

+------------------------------------------------------------------------------+
| (4) giphy@0.2.0                                                              |
+------------------------------------------------------------------------------+
| id: giphy                                                                    |
| version: 0.2.0                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: bash                                                                |
| time: 2020-11-23T12:51:42+11:00                                              |
+------------------------------------------------------------------------------+
|                                                                              |
Traceback (most recent call last):
  File "/var/folders/gp/mm15yx614cg04by6xp_bh2240000gn/T/bitrise589296632/step_src/step.py", line 38, in <module>
    gif = getGif(gifName, apiKey)
  File "/var/folders/gp/mm15yx614cg04by6xp_bh2240000gn/T/bitrise589296632/step_src/step.py", line 30, in getGif
    return data[random.randint(0,len(data) - 1)]['images']['fixed_height']['url']
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/random.py", line 244, in randint
    return self.randrange(a, b+1)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/random.py", line 220, in randrange
    raise ValueError, "empty range for randrange() (%d,%d, %d)" % (istart, istop, width)
ValueError: empty range for randrange() (0,0, 0)