5
5
"""
6
6
7
7
__title__ = "woocommerce-api"
8
- __version__ = "1.2.1 "
9
- __author__ = "Claudio Sanches @ WooThemes "
8
+ __version__ = "2.0.0 "
9
+ __author__ = "Claudio Sanches @ Automattic "
10
10
__license__ = "MIT"
11
11
12
12
from requests import request
13
13
from json import dumps as jsonencode
14
+ from time import time
14
15
from woocommerce .oauth import OAuth
15
16
16
17
try :
@@ -50,14 +51,15 @@ def __get_url(self, endpoint):
50
51
51
52
return "%s%s/%s/%s" % (url , api , self .version , endpoint )
52
53
53
- def __get_oauth_url (self , url , method ):
54
+ def __get_oauth_url (self , url , method , ** kwargs ):
54
55
""" Generate oAuth1.0a URL """
55
56
oauth = OAuth (
56
57
url = url ,
57
58
consumer_key = self .consumer_key ,
58
59
consumer_secret = self .consumer_secret ,
59
60
version = self .version ,
60
- method = method
61
+ method = method ,
62
+ oauth_timestamp = kwargs .get ("oauth_timestamp" , int (time ()))
61
63
)
62
64
63
65
return oauth .get_oauth_url ()
@@ -83,7 +85,7 @@ def __request(self, method, endpoint, data, params=None, **kwargs):
83
85
else :
84
86
encoded_params = urlencode (params )
85
87
url = "%s?%s" % (url , encoded_params )
86
- url = self .__get_oauth_url (url , method )
88
+ url = self .__get_oauth_url (url , method , ** kwargs )
87
89
88
90
if data is not None :
89
91
data = jsonencode (data , ensure_ascii = False ).encode ('utf-8' )
0 commit comments