1+ import requests
2+ import signatures
3+
4+
5+ class Numbuster :
6+ def __init__ (self ,access_token ):
7+ self .access_token = access_token
8+ self .api_url = 'https://api.numbuster.com/api/'
9+ self .headers = {'Host' : 'api.numbuster.com' ,
10+ 'User-Agent' : 'okhttp/3.9.1' ,
11+ 'Accept-Encoding' : 'gzip' ,
12+ 'Connection' : 'keep-alive' }
13+
14+ def v6_comment_list_my (self ,offset :int ,limit :int ):
15+ timestamp = signatures .get_timestamp ()
16+ cnonce = signatures .get_cnonce ()
17+ signature = signatures .signature_v6_comment_list_my (self .access_token ,cnonce ,limit ,offset ,timestamp )
18+ url = self .api_url + f'v6/comment/list/my?offset={ offset } &limit={ limit } ×tamp={ timestamp } &signature={ signature } &cnonce={ cnonce } &access_token={ self .access_token } '
19+ data = requests .get (url ,headers = self .headers )
20+ return data .json ()
21+
22+ def v6_comment_list (self ,phone :str ,offset :int ,limit :int ):
23+ timestamp = signatures .get_timestamp ()
24+ cnonce = signatures .get_cnonce ()
25+ signature = signatures .signature_v6_comment_list (self .access_token ,cnonce ,limit ,offset ,phone ,timestamp )
26+ url = self .api_url + f'v6/comment/list?phone={ phone } &offset={ offset } &limit={ limit } ×tamp={ timestamp } &signature={ signature } &cnonce={ cnonce } &access_token={ self .access_token } '
27+ data = requests .get (url ,headers = self .headers )
28+ return data .json ()
29+
30+ def v6_comment_delete (self ,phone :str ):
31+ timestamp = signatures .get_timestamp ()
32+ cnonce = signatures .get_cnonce ()
33+ signature = signatures .signature_v6_comment_delete (self .access_token ,cnonce ,phone ,timestamp )
34+ url = self .api_url + f'v6/comment/delete?phone={ phone } ×tamp={ timestamp } &signature={ signature } &cnonce={ cnonce } &access_token={ self .access_token } '
35+ data = requests .get (url ,headers = self .headers )
36+ return data .json ()
37+
38+ def v6_old_phone (self ,phone ,locale = 'RU' ):
39+ timestamp = signatures .get_timestamp ()
40+ cnonce = signatures .get_cnonce ()
41+ signature = signatures .signature_v6_old_phone (phone ,self .access_token ,cnonce ,timestamp ,locale )
42+ url = self .api_url + f'v6/old/phone/{ phone } ?access_token={ self .access_token } &locale={ locale } ×tamp={ timestamp } &signature={ signature } &cnonce={ cnonce } '
43+ data = requests .get (url ,headers = self .headers )
44+ return data .json ()
45+
46+ def v6_notice_delete (self ,phone ):
47+ timestamp = signatures .get_timestamp ()
48+ cnonce = signatures .get_cnonce ()
49+ signature = signatures .signature_v6_notice_delete (self .access_token ,cnonce ,phone ,timestamp )
50+ url = self .api_url + f'v6/notice/delete?phone={ phone } ×tamp={ timestamp } &signature={ signature } &cnonce={ cnonce } &access_token={ self .access_token } '
51+ data = requests .post (url ,headers = self .headers )
52+ return data .json ()
53+
54+ def v6_old_sms (self ,phone ,locale = 'RU' ):
55+ timestamp = signatures .get_timestamp ()
56+ cnonce = signatures .get_cnonce ()
57+ signature = signatures .signature_v6_old_sms (phone ,self .access_token ,cnonce ,timestamp ,locale )
58+ url = self .api_url + f'v6/old/sms/{ phone } ?access_token={ self .access_token } &locale={ locale } ×tamp={ timestamp } &signature={ signature } &cnonce={ cnonce } '
59+ data = requests .get (url ,headers = self .headers )
60+ return data .json ()
61+
62+ def v6_report_comment (self ,comment_id :int ,report_text :str ):
63+ url = self .api_url + f'v6/report/comment?comment_id={ comment_id } &report_text={ report_text } &access_token={ self .access_token } '
64+ data = requests .post (url ,headers = self .headers )
65+ return data .json ()
66+
67+ def v6_numcy_subscription_comment_renewal (self ,comment_id :int ):
68+ timestamp = signatures .get_timestamp ()
69+ cnonce = signatures .get_cnonce ()
70+ signature = signatures .signature_v6_numcy_subscription_comment_renewal (self .access_token ,cnonce ,comment_id ,timestamp )
71+ url = self .api_url + f'v6/numcy/subscription/comment/renewal?comment_id={ comment_id } ×tamp={ timestamp } &signature={ signature } &cnonce={ cnonce } &access_token={ self .access_token } '
72+ data = requests .post (url ,headers = self .headers )
73+ return data .json ()
74+
75+ def v6_auth_get (self ,platform = 'Android' ,lang = 'RU' ):
76+ timestamp = signatures .get_timestamp ()
77+ cnonce = signatures .get_cnonce ()
78+ signature = signatures .signature_v6_auth_get (cnonce ,timestamp ,lang ,platform )
79+ url = self .api_url + f'v6/auth/get?platform={ platform } &lang={ lang } ×tamp={ timestamp } &signature={ signature } &cnonce={ cnonce } '
80+ data = requests .get (url ,headers = self .headers )
81+ return data .json ()
82+
83+ def v6_old_search (self ,phone :str ,locale = 'RU' ):
84+ timestamp = signatures .get_timestamp ()
85+ cnonce = signatures .get_cnonce ()
86+ signature = signatures .signature_v6_old_search (phone ,self .access_token ,cnonce ,timestamp ,locale )
87+ url = self .api_url + f'v6/old/search/{ phone } ?access_token={ self .access_token } &locale={ locale } ×tamp={ timestamp } &signature={ signature } &cnonce={ cnonce } '
88+ data = requests .get (url ,headers = self .headers )
89+ return data .json ()
90+
91+ def v6_numcy_subscription_coment_cancel (self ,comment_id :int ):
92+ timestamp = signatures .get_timestamp ()
93+ cnonce = signatures .get_cnonce ()
94+ signature = signatures .signature_v6_numcy_subscription_comment_cancel (self .access_token ,cnonce ,comment_id ,timestamp )
95+ url = self .api_url + f'v6/numcy/subscription/comment/cancel?comment_id={ comment_id } ×tamp={ timestamp } &signature={ signature } &cnonce={ cnonce } &access_token={ self .access_token } '
96+ data = requests .post (url ,headers = self .headers )
97+ return data .json ()
98+
99+ def v6_dailyquest_get (self ):
100+ timestamp = signatures .get_timestamp ()
101+ cnonce = signatures .get_cnonce ()
102+ signature = signatures .signature_v6_dailyquest_get (self .access_token ,cnonce ,timestamp )
103+ url = self .api_url + f'v6/dailyquest/get?timestamp={ timestamp } &signature={ signature } &cnonce={ cnonce } &access_token={ self .access_token } '
104+ data = requests .get (url ,headers = self .headers )
105+ return data .json ()
106+
107+ def v6_auth_facebook (self ,facebook_token ,code ):
108+ timestamp = signatures .get_timestamp ()
109+ cnonce = signatures .get_cnonce ()
110+ signature = signatures .signature_v6_auth_facebook (cnonce ,code ,facebook_token ,timestamp )
111+ url = self .api_url + f'v6/auth/facebook?facebook_token={ facebook_token } &code={ code } ×tamp={ timestamp } &signature={ signature } &cnonce={ cnonce } '
112+ data = requests .post (url ,headers = self .headers )
113+ return data .json ()
114+
115+ def v6_old_profiles_by_phone (self ,phone :str ,locale = 'RU' ):
116+ timestamp = signatures .get_timestamp ()
117+ cnonce = signatures .get_cnonce ()
118+ signature = signatures .signature_v6_old_profiles_by_phone (phone ,self .access_token ,cnonce ,timestamp ,locale )
119+ url = self .api_url + f'v6/old/profiles/by_phone/{ phone } ?access_token={ self .access_token } &locale={ locale } ×tamp={ timestamp } &signature={ signature } &cnonce={ cnonce } '
120+ data = requests .get (url ,headers = self .headers )
121+ return data .json ()
122+
123+ def v6_numcy_balance (self ):
124+ timestamp = signatures .get_timestamp ()
125+ cnonce = signatures .get_cnonce ()
126+ signature = signatures .signature_v6_numcy_balance (self .access_token ,cnonce ,timestamp )
127+ url = self .api_url + f'v6/numcy/balance?timestamp={ timestamp } &signature={ signature } &cnonce={ cnonce } &access_token={ self .access_token } '
128+ data = requests .get (url ,headers = self .headers )
129+ return data .json ()
130+
131+ def v6_numcy_subcription_comment_settings (self ):
132+ timestamp = signatures .get_timestamp ()
133+ cnonce = signatures .get_cnonce ()
134+ signature = signatures .signature_v6_numcy_subscription_comment_settings (self .access_token ,cnonce ,timestamp )
135+ url = self .api_url + f'v6/numcy/subscription/comment/settings?timestamp={ timestamp } &signature={ signature } &cnonce={ cnonce } &access_token={ self .access_token } '
136+ data = requests .get (url ,headers = self .headers )
137+ return data .json ()
138+
139+ def v6_comment_add (self ,phone :str ,text :str ):
140+ text_u = signatures .to_url (text )
141+ timestamp = signatures .get_timestamp ()
142+ cnonce = signatures .get_cnonce ()
143+ signature = signatures .signature_v6_comment_add (self .access_token ,cnonce ,phone ,text_u ,timestimp )
144+ url = self .api_url + f'v6/comment/add?phone={ phone } &text={ text } ×time={ timestamp } &signature={ signature } &cnonce={ cnonce } &access_token={ self .access_token } '
145+ data = requests .post (url ,headers = self .headers )
146+ return data .json ()
147+
148+ def v6_auth_agreement (self ,phone :str ):
149+ timestamp = signatures .get_timestamp ()
150+ cnonce = signatures .get_cnonce ()
151+ signature = signatures .signature_v6_auth_agreement (cnonce ,phone ,timestamp )
152+ url = self .api_url + f'v6/auth/agreement?phone={ phone } ×tamp={ timestamp } &signature={ signature } &cnonce={ cnonce } '
153+ data = requests .post (url ,headers = self .headers )
154+ return data .json ()
155+
156+ def v6_comment_edit (self ,phone :str ,text :str ):
157+ text_u = signatures .to_url (text )
158+ timestamp = signatures .get_timestamp ()
159+ cnonce = signatures .get_cnonce ()
160+ signature = signatures .signature_v6_comment_edit (self .access_token ,cnonce ,phone ,text_u ,timestamp )
161+ url = self .api_url + f'v6/comment/edit?phone={ phone } &text={ text } ×tamp={ timestamp } &signature={ signature } &cnonce={ cnonce } &access_token={ self .access_token } '
162+ data = requests .post (url ,headers = self .headers )
163+ return data .json ()
164+
165+ def v6_dailyquest_calendar (self ):
166+ timestamp = signatures .get_timestamp ()
167+ cnonce = signatures .get_cnonce ()
168+ signature = signatures .signature_v6_dailyquest_calendar (self .access_token ,cnonce ,timestamp )
169+ url = self .api_url + f'v6/dailyquest/calendar?timestamp={ timestamp } &signature={ signature } &cnonce={ cnonce } &access_token={ self .access_token } '
170+ data = requests .get (url ,headers = self .headers )
171+ return data .json ()
172+
173+ def v6_notice_add (self ,phone ,text :str ):
174+ text_u = signatures .to_url (text )
175+ timestamp = signatures .get_timestamp ()
176+ cnonce = signatures .get_cnonce ()
177+ signature = signatures .signature_v6_notice_add (self .access_token ,cnonce ,phone ,text_u ,timestamp )
178+ url = self .api_url + f'v6/notice/add?phone={ phone } &text={ text } ×time={ timestamp } &signature={ signature } &cnonce={ cnonce } &access_token={ self .access_token } '
179+ data = requests .post (url ,headers = self .headers )
180+ return data .json ()
181+
182+ def v6_auth_agreement_code (self ,code :str ):
183+ timestamp = signatures .get_timestamp ()
184+ cnonce = signatures .get_cnonce ()
185+ signature = signatures .signature_v6_auth_agreement_code (cnonce ,code ,timestamp )
186+ url = self .api_url + f'v6/auth/agreement_code?code={ code } ×tamp={ timestamp } &signature={ signature } &cnonce={ cnonce } '
187+ data = requests .post (url ,headers = self .headers )
188+ return data .json ()
189+
190+ def v6_notice_edit (self ,phone :str ,text :str ):
191+ text_u = signatures .to_url (text )
192+ timestamp = signatures .get_timestamp ()
193+ cnonce = signatures .get_cnonce ()
194+ signature = signatures .signature_v6_notice_edit (self .access_token ,cnonce ,phone ,text_u ,timestamp )
195+ url = self .api_url + f'v6/notice/edit?phone={ phone } &text={ text } ×tamp={ timestamp } &signature={ signature } &cnonce={ cnonce } &access_token={ self .access_token } '
196+ data = requests .post (url ,headers = self .headers )
197+ return data .json ()
198+
199+ def v6_auth_check (self ,code :str ):
200+ timestamp = signatures .get_timestamp ()
201+ cnonce = signatures .get_cnonce ()
202+ signature = signatures .signature_v6_auth_check (cnonce ,code ,timestamp )
203+ url = self .api_url + f'v6/auth/check?code={ code } ×tamp={ timestamp } &signature={ signature } &cnonce={ cnonce } '
204+ data = requests .get (url ,headers = self .headers )
205+ return data .json ()
206+
207+
208+
209+ if __name__ == '__main__' :
210+ api = Numbuster ('access_token' )
211+
0 commit comments