Title: Error reporting POST to Product error · Issue #209 · Shopify/shopify_python_api · GitHub
Open Graph Title: Error reporting POST to Product error · Issue #209 · Shopify/shopify_python_api
X Title: Error reporting POST to Product error · Issue #209 · Shopify/shopify_python_api
Description: When there is an error in the product or variants that are sent via post to the Product endpoint, the error message is structured in a way that the underlying pyactiveresource.connection.ResourceInvalid object cannot decode it properly, ...
Open Graph Description: When there is an error in the product or variants that are sent via post to the Product endpoint, the error message is structured in a way that the underlying pyactiveresource.connection.ResourceIn...
X Description: When there is an error in the product or variants that are sent via post to the Product endpoint, the error message is structured in a way that the underlying pyactiveresource.connection.ResourceIn...
Opengraph URL: https://github.com/Shopify/shopify_python_api/issues/209
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Error reporting POST to Product error","articleBody":"When there is an error in the product or variants that are sent via post to the Product endpoint, the error message is structured in a way that the underlying pyactiveresource.connection.ResourceInvalid object cannot decode it properly, which leads to a very un-informative error.\r\nPlease see stacktrace below:\r\n````\r\nTraceback (most recent call last):\r\n File \"C:\\Users\\user\\Dropbox\\virtualenvs\\lighting\\lib\\site-packages\\pyactiveresource\\connection.py\", line 286, in _open\r\n http_response = self._handle_error(self._urlopen(request))\r\n File \"C:\\Users\\user\\Dropbox\\virtualenvs\\lighting\\lib\\site-packages\\pyactiveresource\\connection.py\", line 318, in _urlopen\r\n return urllib.request.urlopen(request)\r\n File \"C:\\Python34\\lib\\urllib\\request.py\", line 161, in urlopen\r\n return opener.open(url, data, timeout)\r\n File \"C:\\Python34\\lib\\urllib\\request.py\", line 469, in open\r\n response = meth(req, response)\r\n File \"C:\\Python34\\lib\\urllib\\request.py\", line 579, in http_response\r\n 'http', request, response, code, msg, hdrs)\r\n File \"C:\\Python34\\lib\\urllib\\request.py\", line 507, in error\r\n return self._call_chain(*args)\r\n File \"C:\\Python34\\lib\\urllib\\request.py\", line 441, in _call_chain\r\n result = func(*args)\r\n File \"C:\\Python34\\lib\\urllib\\request.py\", line 587, in http_error_default\r\n raise HTTPError(req.full_url, code, msg, hdrs, fp)\r\nurllib.error.HTTPError: HTTP Error 422: Unprocessable Entity\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n File \"C:\\Users\\user\\Dropbox\\virtualenvs\\lighting\\lib\\site-packages\\pyactiveresource\\activeresource.py\", line 824, in save\r\n data=self.encode())\r\n File \"C:\\Users\\user\\Dropbox\\virtualenvs\\lighting\\lib\\site-packages\\pyactiveresource\\connection.py\", line 364, in post\r\n return self._open('POST', path, headers=headers, data=data)\r\n File \"C:\\Users\\user\\Dropbox\\virtualenvs\\lighting\\lib\\site-packages\\shopify\\base.py\", line 23, in _open\r\n self.response = super(ShopifyConnection, self)._open(*args, **kwargs)\r\n File \"C:\\Users\\user\\Dropbox\\virtualenvs\\lighting\\lib\\site-packages\\pyactiveresource\\connection.py\", line 288, in _open\r\n http_response = self._handle_error(err)\r\n File \"C:\\Users\\user\\Dropbox\\virtualenvs\\lighting\\lib\\site-packages\\pyactiveresource\\connection.py\", line 414, in _handle_error\r\n raise ResourceInvalid(err)\r\npyactiveresource.connection.ResourceInvalid: Response(code=422, body=\"b'{\"errors\":{\"base\":[\"The variant \\'Antique Bronze \\\\/ Ice pattern\\' already exists. Please change at least one option value.\"]}}'\", headers={'X-XSS-Protection': '1; mode=block; report=/xss-report?source%5Baction%5D=create\u0026source%', 'X-Frame-Options': 'DENY', 'X-Stats-UserId': '0', 'X-Content-Type-Options': 'nosniff', , 'Date': 'Wed, 06 Sep 2017 17:17:23 GMT', 'Strict-Transport-Security': 'max-age=7776000', 'X-Stats-ApiPermissionId': '42905249', 'X-Sorting-Hat-PodId-Cached': '0', 'Content-Security-Policy': \"default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval' https://* shopify-pos://*; block-all-mixed-content; child-src 'self' https://* shopify-pos://*; connect-src 'self' wss://* https://*; script-src https://cdn.shopify.com https://checkout.shopifycs.com https://js-agent.newrelic.com https://bam.nr-data.net https://dme0ih8comzn4.cloudfront.net https://api.stripe.com https://mpsnare.iesnare.com https://appcenter.intuit.com https://www.paypal.com https://maps.googleapis.com https://stats.g.doubleclick.net https://www.google-analytics.com https://visitors.shopify.com https://v.shopify.com https://widget.intercom.io https://js.intercomcdn.com 'self' 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; report-uri /csp-report?source%5Baction%5D=create\u0026source%5Bapp%5D=Shopify\u0026source%5Bcontroller%5D=admin%2Fproducts\u0026source%5Bsection%5D=admin_api\u0026source%5Buuid%5D=5e3df701-e2e3-4b70-bda3-b7d15592a0f5\", 'X-Sorting-Hat-ShopId-Cached': '0', 'Connection': 'close', 'Referrer-Policy': 'origin-when-cross-origin', 'X-Request-Id': '5e3df701-e2e3-4b70-bda3-b7d15592a0f5', 'X-Shopify-Shop-Api-Call-Limit': '1/40', 'Content-Type': 'application/json; charset=utf-8', 'Server': 'nginx', 'X-ShardId': '15', 'X-Dc': 'ash', 'Transfer-Encoding': 'chunked', 'X-Download-Options': 'noopen', 'X-Permitted-Cross-Domain-Policies': 'none', 'HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT': '1/40', 'X-Sorting-Hat-PodId': '15', 'X-Sorting-Hat-Section': 'pod'}, msg=\"Unprocessable Entity\")\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n File \"C:\\Users\\user\\Dropbox\\virtualenvs\\lighting\\xologic_connection\\product.py\", line 692, in create_on_shopify\r\n success = new_product.save()\r\n File \"C:\\Users\\user\\Dropbox\\virtualenvs\\lighting\\lib\\site-packages\\pyactiveresource\\activeresource.py\", line 832, in save\r\n self.errors.from_json(err.response.body)\r\nAttributeError: 'list' object has no attribute 'from_json'\r\n```\r\nThe relevant error is \r\n`body=\"b'{\"errors\":{\"base\":[\"The variant \\'Antique Bronze \\\\/ Ice pattern\\' already exists. Please change at least one option value.\"]}}'\", `\r\n\r\nIt would be nice to get just that.","author":{"url":"https://github.com/hgolov","@type":"Person","name":"hgolov"},"datePublished":"2017-09-06T17:33:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/209/shopify_python_api/issues/209"}
| 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:2db09818-13da-d673-e0f9-93403cc9d5c9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A106:240939:CC451B:111A181:69698893 |
| html-safe-nonce | 4eccf26d919cfdd0943268c0a93568004464d0a31c9a65fa1b5920214abad70f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMTA2OjI0MDkzOTpDQzQ1MUI6MTExQTE4MTo2OTY5ODg5MyIsInZpc2l0b3JfaWQiOiI1MzgxNjM4MDQ3MDcxMzA3OTIzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b2e9931bc0122295c7067a9a7b4fe1d1d915fea6ed140e162a55f8b99e4353b8 |
| hovercard-subject-tag | issue:255684510 |
| 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/209/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 | When there is an error in the product or variants that are sent via post to the Product endpoint, the error message is structured in a way that the underlying pyactiveresource.connection.ResourceIn... |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hgolov |
| hostname | github.com |
| expected-hostname | github.com |
| None | 533e7cac596c452090972c1150d587fd0b36531b8dc4e8bbfe4ab694aca02408 |
| 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 | 63d27af10eea2ccab520b162530cf6c7b739e767 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width