Error reporting POST to Product error
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia da xologic_connection/product.py, riga 692, e segui il percorso di salvataggio e gestione degli errori attraverso lo stack pyactiveresource mostrato nel report. Riproduci la risposta 422 per un prodotto non valido o una variante duplicata, quindi verifica che venga esposto il messaggio di validazione Shopify sottostante invece dell’AttributeError.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
Please see stacktrace below:
Traceback (most recent call last):
File "C:\Users\user\Dropbox\virtualenvs\lighting\lib\site-packages\pyactiveresource\connection.py", line 286, in _open
http_response = self._handle_error(self._urlopen(request))
File "C:\Users\user\Dropbox\virtualenvs\lighting\lib\site-packages\pyactiveresource\connection.py", line 318, in _urlopen
return urllib.request.urlopen(request)
File "C:\Python34\lib\urllib\request.py", line 161, in urlopen
return opener.open(url, data, timeout)
File "C:\Python34\lib\urllib\request.py", line 469, in open
response = meth(req, response)
File "C:\Python34\lib\urllib\request.py", line 579, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Python34\lib\urllib\request.py", line 507, in error
return self._call_chain(*args)
File "C:\Python34\lib\urllib\request.py", line 441, in _call_chain
result = func(*args)
File "C:\Python34\lib\urllib\request.py", line 587, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 422: Unprocessable Entity
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\Dropbox\virtualenvs\lighting\lib\site-packages\pyactiveresource\activeresource.py", line 824, in save
data=self.encode())
File "C:\Users\user\Dropbox\virtualenvs\lighting\lib\site-packages\pyactiveresource\connection.py", line 364, in post
return self._open('POST', path, headers=headers, data=data)
File "C:\Users\user\Dropbox\virtualenvs\lighting\lib\site-packages\shopify\base.py", line 23, in _open
self.response = super(ShopifyConnection, self)._open(*args, **kwargs)
File "C:\Users\user\Dropbox\virtualenvs\lighting\lib\site-packages\pyactiveresource\connection.py", line 288, in _open
http_response = self._handle_error(err)
File "C:\Users\user\Dropbox\virtualenvs\lighting\lib\site-packages\pyactiveresource\connection.py", line 414, in _handle_error
raise ResourceInvalid(err)
pyactiveresource.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&source%', '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&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fproducts&source%5Bsection%5D=admin_api&source%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")
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\Dropbox\virtualenvs\lighting\xologic_connection\product.py", line 692, in create_on_shopify
success = new_product.save()
File "C:\Users\user\Dropbox\virtualenvs\lighting\lib\site-packages\pyactiveresource\activeresource.py", line 832, in save
self.errors.from_json(err.response.body)
AttributeError: 'list' object has no attribute 'from_json'
```
The relevant error is
`body="b'{"errors":{"base":["The variant \'Antique Bronze \\/ Ice pattern\' already exists. Please change at least one option value."]}}'", `
It would be nice to get just that.
- Lingua principale
- Python
- Stelle
- 1.4k
- Fork
- 388
- Merge medio
- 5h 39m
- PR unite (30g)
- 1
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Shopify/shopify_python_api
-
automated
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
Shopify/shopify_python_api#799 ·
-
automated
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Shopify/shopify_python_api#796 · 1 commento ·
-
automated
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Shopify/shopify_python_api#792 ·
-
Account Activation URL Apertafeature request
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
Shopify/shopify_python_api#275 · 4 commenti ·
-
feature request
Difficoltà 2/5 1-3 ore Idoneità per principianti 38/100
Shopify/shopify_python_api#233 ·
Tutte le issue di Shopify/shopify_python_api
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
zostera/django-bootstrap4#894 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
use-agent-os/agent-os#3276 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
NousResearch/hermes-agent#117848 ·