File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -50,11 +50,7 @@ def get_oauth_url(self):
50
50
51
51
params ["oauth_consumer_key" ] = self .consumer_key
52
52
params ["oauth_timestamp" ] = int (time ())
53
- params ["oauth_nonce" ] = HMAC (
54
- str (time () + randint (0 , 99999 )).encode (),
55
- "secret" .encode (),
56
- sha1
57
- ).hexdigest ()
53
+ params ["oauth_nonce" ] = self .generate_nonce ()
58
54
params ["oauth_signature_method" ] = "HMAC-SHA256"
59
55
params ["oauth_signature" ] = self .generate_oauth_signature (params , url )
60
56
@@ -131,3 +127,13 @@ def get_value_like_as_php(val):
131
127
normalized_parameters [key ] = value
132
128
133
129
return normalized_parameters
130
+
131
+ @staticmethod
132
+ def generate_nonce ():
133
+ """ Generate nonce number """
134
+ nonce = '' .join ([str (randint (0 , 9 )) for i in range (8 )])
135
+ return HMAC (
136
+ nonce .encode (),
137
+ "secret" .encode (),
138
+ sha1
139
+ ).hexdigest ()
You can’t perform that action at this time.
0 commit comments