8000 400 errors after updating to Wordpress 4.7 · Issue #23 · woocommerce/wc-api-python · GitHub
[go: up one dir, main page]

Skip to content

400 errors after updating to Wordpress 4.7 #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
shopro opened this issue Dec 7, 2016 · 2 comments
Closed

400 errors after updating to Wordpress 4.7 #23

shopro opened this issue Dec 7, 2016 · 2 comments

Comments

@shopro
Copy link
shopro commented Dec 7, 2016

Latest WooCommerce and now the latest WordPress. Everything worked fine (last night) before update this morning.

curl https://example.com/wp-json/wc/v1/products/9522 -u key:secret

works fine, it gives the product info. Log on the server side (Apache) is "GET /wp-json/wc/v1/products/9522 HTTP/1.1" 200 6484 "-" "curl/7.47.0"

When using the following python it doesn't work.

from woocommerce import API
wcapi = API(
                url="https://example.com",
                consumer_key="key",
                consumer_secret="secret",
                wp_api=True,
                version="wc/v1"
        )
print(wcapi.get("products/9522").json())

Result: {'data': {'json_error_code': 4, 'json_error_message': 'Syntax error', 'status': 400}, 'code': 'rest_invalid_json', 'message': 'Invalid JSON body passed.'}

Server log: "GET /wp-json/wc/v1/products/9522 HTTP/1.1" 400 4742 "-" "WooCommerce API Client-Python/1.2.0"

I made no changes to code, simply updated WordPress from 4.6 to 4.7

@shopro
Copy link
Author
shopro commented Dec 8, 2016

Seems like the problem goes away when commeting out the following.

woocommerce/api.py - line 67
"content-type": "application/json;charset=utf-8",

@claudiosanches
Copy link
Contributor

Fixed on 1.2.1, thanks for report it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0