pycmc icon indicating copy to clipboard operation
pycmc copied to clipboard

[BUG]: credentials process occasionally throws a 504 HTTPError

Open thinkjrs opened this issue 3 years ago • 0 comments

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. pycmc module called
  2. pycmc function utilized
  3. Function parameters input
  4. Python stacktrace
  5. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem. Please only post stacktraces as text.

Step #1 - "Run Unit Tests": FAILED tests/test_artist.py::test_urls - requests.exceptions.HTTPError: 504 S...
Step #1 - "Run Unit Tests": =========================== short test summary info ============================
Step #1 - "Run Unit Tests": /usr/local/lib/python3.8/site-packages/requests/models.py:941: HTTPError
Step #1 - "Run Unit Tests": 
Step #1 - "Run Unit Tests": E           requests.exceptions.HTTPError: 504 Server Error: Gateway Time-out for url: https://api.chartmetric.com/api/token
Step #1 - "Run Unit Tests": >           raise HTTPError(http_error_msg, response=self)
Step #1 - "Run Unit Tests":         if http_error_msg:
Step #1 - "Run Unit Tests":     
Step #1 - "Run Unit Tests":             http_error_msg = u'%s Server Error: %s for url: %s' % (self.status_code, reason, self.url)
Step #1 - "Run Unit Tests":         elif 500 <= self.status_code < 600:
Step #1 - "Run Unit Tests":     
Step #1 - "Run Unit Tests":             http_error_msg = u'%s Client Error: %s for url: %s' % (self.status_code, reason, self.url)
Step #1 - "Run Unit Tests":         if 400 <= self.status_code < 500:
Step #1 - "Run Unit Tests":     
Step #1 - "Run Unit Tests":             reason = self.reason
Step #1 - "Run Unit Tests":         else:
Step #1 - "Run Unit Tests":                 reason = self.reason.decode('iso-8859-1')
Step #1 - "Run Unit Tests":             except UnicodeDecodeError:
Step #1 - "Run Unit Tests":                 reason = self.reason.decode('utf-8')
Step #1 - "Run Unit Tests":             try:
Step #1 - "Run Unit Tests":             # encodings. (See PR #3538)
Step #1 - "Run Unit Tests":             # isn't utf-8, we fall back to iso-8859-1 for all other
Step #1 - "Run Unit Tests":             # choose to localize their reason strings. If the string
Step #1 - "Run Unit Tests":             # We attempt to decode utf-8 first because some servers
Step #1 - "Run Unit Tests":         if isinstance(self.reason, bytes):
Step #1 - "Run Unit Tests":         http_error_msg = ''
Step #1 - "Run Unit Tests":     
Step #1 - "Run Unit Tests":         """Raises :class:`HTTPError`, if one occurred."""
Step #1 - "Run Unit Tests":     def raise_for_status(self):
Step #1 - "Run Unit Tests": 
Step #1 - "Run Unit Tests": self = <Response [504]>
Step #1 - "Run Unit Tests": 
Step #1 - "Run Unit Tests": _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
Step #1 - "Run Unit Tests":     response.raise_for_status()
Step #1 - "Run Unit Tests": pycmc/credentials.py:182: in FetchAccessToken
Step #1 - "Run Unit Tests":     fetched = FetchAccessToken()
Step #1 - "Run Unit Tests": pycmc/credentials.py:103: in Update
Step #1 - "Run Unit Tests":     credentials.Update()  # first refresh our credentials
Step #1 - "Run Unit Tests": pycmc/credentials_manager.py:52: in <module>
Step #1 - "Run Unit Tests":     ???
Step #1 - "Run Unit Tests": <frozen importlib._bootstrap>:219: in _call_with_frames_removed
Step #1 - "Run Unit Tests":     ???
Step #1 - "Run Unit Tests": <frozen importlib._bootstrap_external>:783: in exec_module
Step #1 - "Run Unit Tests":     ???
Step #1 - "Run Unit Tests": <frozen importlib._bootstrap>:604: in _exec
Step #1 - "Run Unit Tests":     _bootstrap._exec(spec, module)
Step #1 - "Run Unit Tests": /usr/local/lib/python3.8/importlib/__init__.py:169: in reload
Step #1 - "Run Unit Tests":     reload(
Step #1 - "Run Unit Tests": pycmc/utilities.py:95: in RequestData
Step #1 - "Run Unit Tests":     data = utilities.RequestData(urlhandle, params)
Step #1 - "Run Unit Tests": pycmc/artist.py:308: in urls
Step #1 - "Run Unit Tests": _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
Step #1 - "Run Unit Tests": tests/test_artist.py:118: 
Step #1 - "Run Unit Tests": 
Step #1 - "Run Unit Tests": >       test = pycmc.artist.urls("3380",)
Step #1 - "Run Unit Tests":     def test_urls():
Step #1 - "Run Unit Tests": 
Step #1 - "Run Unit Tests": __________________________________ test_urls 

Additional context Add any other context about the problem here.

thinkjrs avatar Aug 07 '20 21:08 thinkjrs