Skip to content

Commit 9202c44

Browse files
Added support for WP REST API
1 parent bb7d82a commit 9202c44

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

woocommerce/api.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def __init__(self, url, consumer_key, consumer_secret, **kwargs):
2121
self.url = url
2222
self.consumer_key = consumer_key
2323
self.consumer_secret = consumer_secret
24+
self.wp_api = kwargs.get("wp_api", False)
2425
self.version = kwargs.get("version", "v3")
2526
self.is_ssl = self.__is_ssl()
2627
self.timeout = kwargs.get("timeout", 5)
@@ -33,11 +34,15 @@ def __is_ssl(self):
3334
def __get_url(self, endpoint):
3435
""" Get URL for requests """
3536
url = self.url
37+
api = "wc-api"
3638

3739
if url.endswith("/") is False:
3840
url = "%s/" % url
3941

40-
return "%swc-api/%s/%s" % (url, self.version, endpoint)
42+
if self.wp_api:
43+
api = "wp-json"
44+
45+
return "%s%s/%s/%s" % (url, api, self.version, endpoint)
4146

4247
def __get_oauth_url(self, url, method):
4348
""" Generate oAuth1.0a URL """

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy