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

Giphy step fails due to network error #3

Open orestesgaolin opened 5 years ago

orestesgaolin commented 5 years ago

I have Giphy step at the end of my workflow and it exits with following error:

+------------------------------------------------------------------------------+

| (2) giphy                                                                    |
+------------------------------------------------------------------------------+
| id: giphy                                                                    |
| version: 0.1.1                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: bash                                                                |
| time: 2019-05-09T19:54:05Z                                                   |
+------------------------------------------------------------------------------+
|                                                                              |
Traceback (most recent call last):
  File "/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/bitrise569362648/step_src/step.py", line 36, in <module>
    gif = getGif(gifName)
  File "/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/bitrise569362648/step_src/step.py", line 31, in getGif
    data = getJson(baseUrl, queryParams)['data']
  File "/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/bitrise569362648/step_src/step.py", line 15, in getJson
    response = urllib2.urlopen(url)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 435, in open
    response = meth(req, response)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 548, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 473, in error
    return self._call_chain(*args)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 556, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 429: Unknown Error
WARN[19:54:07] Step (giphy) failed, but was marked as skippable 

This is part of my workflow that is related to Giphy:

    - script:
        inputs:
        - content: |-
            #!/bin/bash
            set -e
            set -x

            if [ $BITRISE_BUILD_STATUS -eq 1 ]
              then envman add --key GIPHY_KEYWORDS --value "fail,disappointed,try again"
              else envman add --key GIPHY_KEYWORDS --value "success,congrats,victory"
            fi

            end=$(date +%s)
            let duration=end-BITRISE_BUILD_TRIGGER_TIMESTAMP
            echo $duration
    - giphy:
        inputs:
        - gif_words: "$GIPHY_KEYWORDS"
TomWayne98 commented 5 years ago

I have the same problem

orestesgaolin commented 5 years ago

I checked the source code and the included API key reached limit. Maybe this is the reason?

Almouro commented 5 years ago

@orestesgaolin indeed, seems like it is the reason. ~I'll request an production API key~ Actually I'll make the API key a parameter from the step

Almouro commented 5 years ago

Linked PR for the step lib: https://github.com/bitrise-io/bitrise-steplib/pull/2011/files