Title: Inappropriate use of `print` · Issue #57 · Smartling/api-sdk-python · GitHub
Open Graph Title: Inappropriate use of `print` · Issue #57 · Smartling/api-sdk-python
X Title: Inappropriate use of `print` · Issue #57 · Smartling/api-sdk-python
Description: In multiple places in your SDK, you're using print outside the examples: $ fd --exclude 'example' -X rg print ./HttpClient.py 95: print("Non 200 response:%s RequestId:%s URL:%s response:%s" % ./ObsoleteSmartlingFileApi.py 34: for k,v in ...
Open Graph Description: In multiple places in your SDK, you're using print outside the examples: $ fd --exclude 'example' -X rg print ./HttpClient.py 95: print("Non 200 response:%s RequestId:%s URL:%s response:%s" % ./Obs...
X Description: In multiple places in your SDK, you're using print outside the examples: $ fd --exclude 'example' -X rg print ./HttpClient.py 95: print("Non 200 response:%s RequestId:%s URL:%s res...
Opengraph URL: https://github.com/Smartling/api-sdk-python/issues/57
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inappropriate use of `print`","articleBody":"In multiple places in your SDK, you're using `print` outside the examples:\r\n```\r\n$ fd --exclude 'example' -X rg print\r\n./HttpClient.py\r\n95: print(\"Non 200 response:%s RequestId:%s URL:%s response:%s\" %\r\n\r\n./ObsoleteSmartlingFileApi.py\r\n34: for k,v in response.items(): print k, ':' ,v\r\n\r\n./MultipartPostHandler.py\r\n78: print(\"Replacing %s with %s\" % (request.get_header('content-type'), 'multipart/form-data'))\r\n\r\n./SmartlingProjectsApiV2.py\r\n32: for k,v in response.items(): print k, ':' ,v\r\n\r\n./SmartlingFileApiV2.py\r\n33: for k,v in response.items(): print k, ':' ,v\r\n\r\n./AuthClient.py\r\n53: print(e)\r\n\r\n./FileApiBase.py\r\n98: print (\"code:%d RequestId:%s jsonBody=%s\" % (code, rId, jsonBody))\r\n```\r\n\r\ne.g.\r\nhttps://github.com/Smartling/api-sdk-python/blob/f65d52b2361dbc29730ad82c85e7bbe7df644043/smartlingApiSdk/HttpClient.py#L95-L97\r\n\r\nThat leads to unexpected results for the users (myself included):\r\n```python\r\nIn [18]: 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\n\r\nNote that the error is printed to the standard output. This is unexpected because in the app I'm integrating Smartling into, I would check for `status` and then log `resp.errors` or raise an exception. That print would be a redundant noise injected into the app normal output (logs and warnings, primarily).\r\n\r\nI think you should consider either removing those `print`s (if those are accidental debug prints) or replacing them with (debug-level?) `logging` (which I know you're already configured and use in other places)—depending on each case, I believe.","author":{"url":"https://github.com/Toreno96","@type":"Person","name":"Toreno96"},"datePublished":"2023-10-12T13:20:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/57/api-sdk-python/issues/57"}
| 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:ab98e398-d024-2af8-403c-8daae36435a7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8992:10046D:38CF11D:4958A6B:6974C53C |
| html-safe-nonce | 5a240a90c21452742b3e00bf37602eba22dc03b5c83a60fb2164654109f9ad9a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTkyOjEwMDQ2RDozOENGMTFEOjQ5NThBNkI6Njk3NEM1M0MiLCJ2aXNpdG9yX2lkIjoiNjcyNTkxMDI1NjI0MzY4NDQ0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3eff6a829b97db303b64124b46bc63e91d24c8c4486b5a9d0befac43ac2d43c3 |
| hovercard-subject-tag | issue:1939992432 |
| 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/57/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f0e25b0ff983a24854e1ab4f0a227ece7a62dd2ce51671a4ed7ab3c0584fc8ba/Smartling/api-sdk-python/issues/57 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f0e25b0ff983a24854e1ab4f0a227ece7a62dd2ce51671a4ed7ab3c0584fc8ba/Smartling/api-sdk-python/issues/57 |
| og:image:alt | In multiple places in your SDK, you're using print outside the examples: $ fd --exclude 'example' -X rg print ./HttpClient.py 95: print("Non 200 response:%s RequestId:%s URL:%s response:%s" % ./Obs... |
| 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