6
6
7
7
from .base import BaseApi
8
8
9
+
9
10
class Api (BaseApi ):
10
11
"""API version 1"""
12
+
11
13
version = 1
12
14
13
15
def wikis (self ):
@@ -19,8 +21,9 @@ def wiki(self):
19
21
def all_pages (self ):
20
22
return self ._request ("page" )
21
23
22
- def all_pages_since (self , since , * ,
23
- limit = None , offset = None , direction = None ):
24
+ def all_pages_since (
25
+ self , since , * , limit = None , offset = None , direction = None
26
+ ):
24
27
data = {
25
28
'limit' : 20 if limit is None else limit ,
26
29
'offset' : 0 if offset is None else offset ,
@@ -39,8 +42,9 @@ def page_by_slug(self, page_slug):
39
42
def all_page_revisions (self , page_id ):
40
43
return self ._request ("page/{}/revisions" , page_id )
41
44
42
- def page_revisions (self , page_id , * ,
43
- limit = None , offset = None , direction = None ):
45
+ def page_revisions (
46
+ self , page_id , * , limit = None , offset = None , direction = None
47
+ ):
44
48
data = {
45
49
'limit' : 20 if limit is None else limit ,
46
50
'offset' : 0 if offset is None else offset ,
@@ -72,8 +76,9 @@ def forum(self, forum_id):
72
76
def forum_threads (self , forum_id ):
73
77
return self ._request ("forum/{}/threads" , forum_id )
74
78
75
- def forum_threads_since (self , forum_id , since , * ,
76
- limit = None , offset = None , direction = None ):
79
+ def forum_threads_since (
80
+ self , forum_id , since , * , limit = None , offset = None , direction = None
81
+ ):
77
82
data = {
78
83
'timestamp' : since ,
79
84
'limit' : 20 if limit is None else limit ,
@@ -90,17 +95,19 @@ def thread(self, thread_id):
90
95
def all_thread_posts (self , thread_id ):
91
96
return self ._request ("thread/{}/posts" , thread_id )
92
97
93
- def thread_posts (self , thread_id , * ,
94
- limit = None , offset = None , direction = None ):
98
+ def thread_posts (
99
+ self , thread_id , * , limit = None , offset = None , direction = None
100
+ ):
95
101
data = {
96
102
'limit' : 20 if limit is None else limit ,
97
103
'offset' : 0 if offset is None else offset ,
98
104
'direction' : 'asc' if direction is None else direction ,
99
105
}
100
106
return self ._request ("thread/{}/posts" , thread_id , data )
101
107
102
- def thread_posts_since (self , thread_id , since , * ,
103
- limit = None , offset = None , direction = None ):
108
+ def thread_posts_since (
109
+ self , thread_id , since , * , limit = None , offset = None , direction = None
110
+ ):
104
111
data = {
105
112
'timestamp' : since ,
106
113
'limit' : 20 if limit is None else limit ,
@@ -135,8 +142,9 @@ def all_wikidotuser_pages(self, wikidotuser_id):
135
142
raise TypeError ("The Wikidot user ID must be an int" )
136
143
return self ._request ("wikidotuser/{}/pages" , wikidotuser_id )
137
144
138
- def wikidotuser_pages (self , wikidotuser_id , * ,
139
- limit = None , offset = None , direction = None ):
145
+ def wikidotuser_pages (
146
+ self , wikidotuser_id , * , limit = None , offset = None , direction = None
147
+ ):
140
148
data = {
141
149
'limit' : 20 if limit is None else limit ,
142
150
'offset' : 0 if offset is None else offset ,
@@ -151,8 +159,9 @@ def all_wikidotuser_posts(self, wikidotuser_id):
151
159
raise TypeError ("The Wikidot user ID must be an int" )
152
160
return self ._request ("wikidotuser/{}/posts" , wikidotuser_id )
153
161
154
- def wikidotuser_posts (self , wikidotuser_id , * ,
155
- limit = None , offset = None , direction = None ):
162
+ def wikidotuser_posts (
163
+ self , wikidotuser_id , * , limit = None , offset = None , direction = None
164
+ ):
156
165
data = {
157
166
'limit' : 20 if limit is None else limit ,
158
167
'offset' : 0 if offset is None else offset ,
@@ -167,8 +176,9 @@ def all_wikidotuser_revisions(self, wikidotuser_id):
167
176
raise TypeError ("The Wikidot user ID must be an int" )
168
177
return self ._request ("wikidotuser/{}/revisions" , wikidotuser_id )
169
178
170
- def wikidotuser_revisions (self , wikidotuser_id , * ,
171
- limit = None , offset = None , direction = None ):
179
+ def wikidotuser_revisions (
180
+ self , wikidotuser_id , * , limit = None , offset = None , direction = None
181
+ ):
172
182
data = {
173
183
'limit' : 20 if limit is None else limit ,
174
184
'offset' : 0 if offset is None else offset ,
@@ -194,8 +204,9 @@ def tag_pages(self, tags):
194
204
raise TypeError ("A single tag must be a string" )
195
205
return self ._request ("tag/{}/pages" , tags )
196
206
197
- def tags_pages (self , tags , operator = 'and' , * ,
198
- limit = None , offset = None , direction = None ):
207
+ def tags_pages (
208
+ self , tags , operator = 'and' , * , limit = None , offset = None , direction = None
209
+ ):
199
210
"""
200
211
str[] `tags`: A list of tags, finds all page IDs that match the
201
212
condition.
@@ -205,8 +216,9 @@ def tags_pages(self, tags, operator='and', *,
205
216
multiple tags.
206
217
"""
207
218
if isinstance (tags , str ):
208
- raise TypeError ("tags must be str[] or int[]; use tag_pages()"
209
- "for single tags" )
219
+ raise TypeError (
220
+ "tags must be str[] or int[]; use tag_pages()" "for single tags"
221
+ )
210
222
if not isinstance (tags , Iterable ):
211
223
raise TypeError ("tags must be a list of str or int" )
212
224
data = {
0 commit comments