woocommerce / wc-api-python

A Python wrapper for the WooCommerce API.
https://pypi.org/project/WooCommerce/
MIT License
212 stars 112 forks source link

JSONDecodeError #40

Closed marosmola closed 5 years ago

marosmola commented 6 years ago

Sometimes when when i want to get response in json format: r.json()

i get this error: json.decoder.JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)

what could be the problem? is there any way to fix this?

claudiosanches commented 5 years ago

what could be the problem? is there any way to fix this?

The problem is already in the error message: Unexpected UTF-8 BOM (decode using utf-8-sig).

For some reason your website is inserting a BOM character in all WordPress REST API responses, generally this comes from your wp-config.php file, people open in Windows notepad and introduces BOM character, so just try to find where it comes and remove, but not an issue with this library.