atlassian-api / atlassian-python-api

Atlassian Python REST API wrapper
https://atlassian-python-api.readthedocs.io
Apache License 2.0
1.34k stars 661 forks source link

lists and dicts can be handled in raise_for_status #1234

Closed Ch3ri0ur closed 1 year ago

Ch3ri0ur commented 1 year ago

This should solve #1230.

I tried to straighten out the code a bit.

I am not sure why we checked if the key from .items() is a dict. That is not possible.

tdk = {"hello": "world"}
td = {tdk: "cool it works"}
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: unhashable type: 'dict'

I guess in an earlier version we iterated over a presumed dict and named the variable k(for key) (But in the background it was a list). https://github.com/atlassian-api/atlassian-python-api/commit/fc620ae094c162f36d93ceaa0998ebbc1ca9bf20

Then it was modified. But they then stopped iterating over the object but iterated over the items, which are apparently not always present. https://github.com/atlassian-api/atlassian-python-api/commit/4bb337a5d262912d6459d12d51aecf549e186eb5

I looks like some classic list/dict confusion but in the end I am not sure what possible responses are. Feedback would be appreciated.

I shoehorned a testcases in there to check for this error.

With regards to https://github.com/atlassian-api/atlassian-python-api/pull/1228 . The response I got with that error has the content-type: 'application/json;charset=UTF-8' which he specifically does not trigger for.

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 85.71% and project coverage change: +0.03% :tada:

Comparison is base (fa7415e) 34.43% compared to head (c93ccaf) 34.46%.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1234 +/- ## ========================================== + Coverage 34.43% 34.46% +0.03% ========================================== Files 44 44 Lines 8091 8097 +6 Branches 1115 1117 +2 ========================================== + Hits 2786 2791 +5 Misses 5192 5192 - Partials 113 114 +1 ``` | [Files Changed](https://app.codecov.io/gh/atlassian-api/atlassian-python-api/pull/1234?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [atlassian/rest\_client.py](https://app.codecov.io/gh/atlassian-api/atlassian-python-api/pull/1234?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-YXRsYXNzaWFuL3Jlc3RfY2xpZW50LnB5) | `67.79% <85.71%> (+0.54%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.