Title: Non-CLI parts of the library must not write anything to stdout/stderr · Issue #678 · Shopify/shopify_python_api · GitHub
Open Graph Title: Non-CLI parts of the library must not write anything to stdout/stderr · Issue #678 · Shopify/shopify_python_api
X Title: Non-CLI parts of the library must not write anything to stdout/stderr · Issue #678 · Shopify/shopify_python_api
Description: Issue summary Currently, if the error happens during the GraphQL request the response body is being printed to stdout along with an empty line Libraries must not print anything to the console because they're being used in other applicati...
Open Graph Description: Issue summary Currently, if the error happens during the GraphQL request the response body is being printed to stdout along with an empty line Libraries must not print anything to the console becau...
X Description: Issue summary Currently, if the error happens during the GraphQL request the response body is being printed to stdout along with an empty line Libraries must not print anything to the console becau...
Opengraph URL: https://github.com/Shopify/shopify_python_api/issues/678
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Non-CLI parts of the library must not write anything to stdout/stderr","articleBody":"# Issue summary\r\n\r\nCurrently, if the error happens during the GraphQL request the response body is [being printed to stdout](https://github.com/Shopify/shopify_python_api/blob/5f295932bebbdde1835d35c4865093ff83564cdc/shopify/resources/graphql.py#L30-L31) along with an empty line\r\n\r\nLibraries must not print anything to the console because they're being used in other applications and the way these applications treat the stdout/stderr could vary:\r\n* User-facing CLIs could use the the stdout to present the data to users and they do it in a way they need it. Having a raw response in the stdout wouldn't be a desirable behavior\r\n* Server-side application often use stdout/stderr to stream logs. And logs are often expected to be in a certain format. Unexpectedly formatted log entries can negatively affect log viewers/analyzers\r\n\r\n\r\n## Expected behavior\r\n\r\nThe library doesn't do raw `print`s to the stdout. It does the logging using the standard way of [logging](https://docs.python.org/3/howto/logging.html) in Python using `logging` module\r\n\r\n\r\n## Actual behavior\r\n\r\nThe library [`print`s raw GraphQL responses](https://github.com/Shopify/shopify_python_api/blob/5f295932bebbdde1835d35c4865093ff83564cdc/shopify/resources/graphql.py#L30-L31)\r\n\r\n## Steps to reproduce the problem\r\n\r\n1. Issue an incorrect request to GraphQL API which leads to a HTTP error\r\n\r\n## Reduced test case\r\n\r\nN/A\r\n\r\n\r\n---\r\n\r\n## Checklist\r\n\r\n- [x] I have described this issue in a way that is actionable (if possible)\r\n","author":{"url":"https://github.com/outring","@type":"Person","name":"outring"},"datePublished":"2023-08-18T08:19:06.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/678/shopify_python_api/issues/678"}
| 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:636cdd7a-5ca3-ca1a-3880-5c3f0d256406 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9A1C:FB44E:23C56F:316B8D:696943F2 |
| html-safe-nonce | 5efbb4d5926c43596d9e14302a3cb470b95f27acb9ca03418d2bf5c9986cfc4c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QTFDOkZCNDRFOjIzQzU2RjozMTZCOEQ6Njk2OTQzRjIiLCJ2aXNpdG9yX2lkIjoiOTEyMDM3NzUxNTk3OTM5MTk4NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d7b95cdba30e50b99bacc7bc944e3854b319cbc42dc3eb1356989882561449f6 |
| hovercard-subject-tag | issue:1856280808 |
| 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/Shopify/shopify_python_api/678/issue_layout |
| twitter:image | https://avatars.githubusercontent.com/u/8085?s=400&v=4 |
| twitter:card | summary |
| og:image | https://avatars.githubusercontent.com/u/8085?s=400&v=4 |
| og:image:alt | Issue summary Currently, if the error happens during the GraphQL request the response body is being printed to stdout along with an empty line Libraries must not print anything to the console becau... |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | outring |
| hostname | github.com |
| expected-hostname | github.com |
| None | 54182691a21263b584d2e600b758e081b0ff1d10ffc0d2eefa51cf754b43b51d |
| turbo-cache-control | no-preview |
| go-import | github.com/Shopify/shopify_python_api git https://github.com/Shopify/shopify_python_api.git |
| octolytics-dimension-user_id | 8085 |
| octolytics-dimension-user_login | Shopify |
| octolytics-dimension-repository_id | 2249127 |
| octolytics-dimension-repository_nwo | Shopify/shopify_python_api |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 2249127 |
| octolytics-dimension-repository_network_root_nwo | Shopify/shopify_python_api |
| 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 | d69ac0477df0f87da03b8b06cebd187012d7a930 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width