Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

エラーの際の response body を表示 #15

Open
ryfjwr opened this issue Jun 6, 2019 · 1 comment
Open

エラーの際の response body を表示 #15

ryfjwr opened this issue Jun 6, 2019 · 1 comment

Comments

@ryfjwr
Copy link
Contributor

ryfjwr commented Jun 6, 2019

こんな感じで 400 であることは分かるのだが、原因がよくわからないので、response body などを見やすくする

  File "/usr/local/lib/python3.6/site-packages/ssmc.py", line 442, in lock_imei
    self._request(method="put", path=path, data=json.dumps(payload))
  File "/usr/local/lib/python3.6/site-packages/ssmc.py", line 186, in _request
    r.raise_for_status()
  File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 939, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://secure.sakura.ad.jp/cloud/zone/is1a/api/cloud/1.1/commonserviceitem/*******/

こんな感じなので error_msg を表示するようにしたい

{‘is_fatal’: True, ‘serial’: ‘****’, ‘status’: ‘400 Bad Request’, ‘error_code’: ‘bad_request’, ‘error_msg’: ‘不適切な要求です。パラメータの指定誤り、入力規則違反です。入力内容を
ご確認ください。\nパスコードが正しくありません。’}
Traceback (most recent call last):
@ryfjwr
Copy link
Contributor Author

ryfjwr commented Jun 11, 2019

リクエストパラメータが何を送ったのか、も出したい

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant