Title: Why requests return a separate `status`? · Issue #58 · Smartling/api-sdk-python · GitHub
Open Graph Title: Why requests return a separate `status`? · Issue #58 · Smartling/api-sdk-python
X Title: Why requests return a separate `status`? · Issue #58 · Smartling/api-sdk-python
Description: According to your official docs, requests return a tuple of (response, status). This is counter-intuitive for me because HTTP status is already present as a property of response, even if the response is other than 2xx: In [25]: resp, sta...
Open Graph Description: According to your official docs, requests return a tuple of (response, status). This is counter-intuitive for me because HTTP status is already present as a property of response, even if the respon...
X Description: According to your official docs, requests return a tuple of (response, status). This is counter-intuitive for me because HTTP status is already present as a property of response, even if the respon...
Opengraph URL: https://github.com/Smartling/api-sdk-python/issues/58
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Why requests return a separate `status`?","articleBody":"According to your [official docs](https://help.smartling.com/hc/en-us/articles/4412947322267#MakingAPIrequests), requests return a tuple of `(response, status)`. This is counter-intuitive for me because HTTP status is already present as a property of `response`, even if the response is other than `2xx`:\r\n```python\r\nIn [25]: resp, status = jobs_api.getJobDetails('foo')\r\nNon 200 response:404 RequestId:Unknown URL:https://api.smartling.com/jobs-api/v3/projects/3bea86d16/jobs/foo response:b'{\"response\":{\"code\":\"NOT_FOUND_ERROR\",\"errors\":[{\"key\":\"not.found\",\"message\":\"Translation job is not found\",\"details\":null}]}}'\r\n\r\nIn [26]: resp.statusCode\r\nOut[26]: 404\r\n\r\nIn [27]: resp.statusCode == status\r\nOut[27]: True\r\n```\r\n\r\nThat makes it slightly less convenient to use because for each request I would need to remember to ignore `status` via `resp, _ = …`.\r\n\r\n**Or is there a reason `status` is separate and I should prefer it over `resp.statusCode`?**","author":{"url":"https://github.com/Toreno96","@type":"Person","name":"Toreno96"},"datePublished":"2023-10-12T13:27:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/58/api-sdk-python/issues/58"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:77cc12e2-afd7-ee96-73b2-14003fc35bc8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ADCA:3E4000:3A19766:4B7A68A:6975062A |
| html-safe-nonce | 4d9b337f974488b09d3dece13c95ba610ceda50a0b3dd2806e826f28aed0ecdb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRENBOjNFNDAwMDozQTE5NzY2OjRCN0E2OEE6Njk3NTA2MkEiLCJ2aXNpdG9yX2lkIjoiMzM0MzgwMDg5Mjc5MzE3NTQ2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 28a0877fd59d6b27038a94b39da2dd74e18b6fa56ff091ab007cbd42b4438117 |
| hovercard-subject-tag | issue:1940005062 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/Smartling/api-sdk-python/58/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7bbcc091d78f2597255d0b2e22336826442ad6b5bcf2e5b989b339516c38fbb1/Smartling/api-sdk-python/issues/58 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7bbcc091d78f2597255d0b2e22336826442ad6b5bcf2e5b989b339516c38fbb1/Smartling/api-sdk-python/issues/58 |
| og:image:alt | According to your official docs, requests return a tuple of (response, status). This is counter-intuitive for me because HTTP status is already present as a property of response, even if the respon... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Toreno96 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4a4bf5f4e28041a9d2e5c107d7d20b78b4294ba261cab243b28167c16a623a1f |
| turbo-cache-control | no-preview |
| go-import | github.com/Smartling/api-sdk-python git https://github.com/Smartling/api-sdk-python.git |
| octolytics-dimension-user_id | 1492945 |
| octolytics-dimension-user_login | Smartling |
| octolytics-dimension-repository_id | 3796345 |
| octolytics-dimension-repository_nwo | Smartling/api-sdk-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3796345 |
| octolytics-dimension-repository_network_root_nwo | Smartling/api-sdk-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 488b30e96dfd057fbbe44c6665ccbc030b729dde |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width