aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.rst2
-rw-r--r--TODO.md2
-rw-r--r--docs/index.rst15
-rw-r--r--mastodon/Mastodon.py26
-rw-r--r--tests/cassettes/test_account_familiar_followers.yaml474
-rw-r--r--tests/test_account.py16
6 files changed, 526 insertions, 9 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index b3123dd..b21064f 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -4,6 +4,7 @@ version number. Breaking changes will be indicated by a change in the minor
4 4
5v1.8.0 (in progress) 5v1.8.0 (in progress)
6-------------------- 6--------------------
7* Overall: Support level is now 3.5.3 (last before 4.0.0)
7* BREAKING CHANGE: Switch the base URL to None, throw an error when no base url is passed. Having mastosoc as default was sensible when there were only three mastodon servers. It is not sensible now and trips people up constantly. 8* BREAKING CHANGE: Switch the base URL to None, throw an error when no base url is passed. Having mastosoc as default was sensible when there were only three mastodon servers. It is not sensible now and trips people up constantly.
8* Fixed an issue with the fix for the Pleroma date bug (thanks adbenitez) 9* Fixed an issue with the fix for the Pleroma date bug (thanks adbenitez)
9* Added trending APIs (`trending_tags`, `trending_statuses`, `trending_links`, `admin_trending_tags`, `admin_trending_statuses`, `admin_trending_links`) 10* Added trending APIs (`trending_tags`, `trending_statuses`, `trending_links`, `admin_trending_tags`, `admin_trending_statuses`, `admin_trending_links`)
@@ -14,6 +15,7 @@ v1.8.0 (in progress)
14* Added the domain blocking admin API (`admin_domain_blocks`, `admin_domain_block`, `admin_update_domain_block`, `admin_delete_domain_block` - thanks catgoat) 15* Added the domain blocking admin API (`admin_domain_blocks`, `admin_domain_block`, `admin_update_domain_block`, `admin_delete_domain_block` - thanks catgoat)
15* Added the stats admin APIs (`admin_measures`, `admin_dimensions`, `admin_retention`) 16* Added the stats admin APIs (`admin_measures`, `admin_dimensions`, `admin_retention`)
16* Added client auth data to access token file. 17* Added client auth data to access token file.
18* Added `account_familiar_followers` API
17 19
18v1.7.0 20v1.7.0
19------ 21------
diff --git a/TODO.md b/TODO.md
index b61cee2..6018703 100644
--- a/TODO.md
+++ b/TODO.md
@@ -45,7 +45,7 @@ Refer to mastodon changelog and API docs for details when implementing, add or m
45* [x] Add notifications for posts deleted by moderators <- by email. not actually API relevant. 45* [x] Add notifications for posts deleted by moderators <- by email. not actually API relevant.
46* [x] Add explore page with trending posts and links 46* [x] Add explore page with trending posts and links
47* [x] Add graphs and retention metrics to admin dashboard 47* [x] Add graphs and retention metrics to admin dashboard
48* [ ] Add GET /api/v1/accounts/familiar_followers to REST API 48* [x] Add GET /api/v1/accounts/familiar_followers to REST API
49* [ ] Add POST /api/v1/accounts/:id/remove_from_followers to REST API 49* [ ] Add POST /api/v1/accounts/:id/remove_from_followers to REST API
50* [x] Add category and rule_ids params to POST /api/v1/reports IN REST API 50* [x] Add category and rule_ids params to POST /api/v1/reports IN REST API
51* [x] Add global lang param to REST API 51* [x] Add global lang param to REST API
diff --git a/docs/index.rst b/docs/index.rst
index 0a6c43b..d035be3 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -864,6 +864,18 @@ Announcement dicts
864 } ], 864 } ],
865 } 865 }
866 866
867Familiar follower dicts
868~~~~~~~~~~~~~~~~~~~~~~~
869.. _familiar follower dict:
870
871.. code-block:: python
872
873 mastodon.account_familiar_followers(1)[0]
874 # Returns the following dictionary:
875 {
876
877 }
878
867Admin account dicts 879Admin account dicts
868~~~~~~~~~~~~~~~~~~~ 880~~~~~~~~~~~~~~~~~~~
869.. _admin account dict: 881.. _admin account dict:
@@ -1087,8 +1099,9 @@ their relationships.
1087.. automethod:: Mastodon.account_followers 1099.. automethod:: Mastodon.account_followers
1088.. automethod:: Mastodon.account_relationships 1100.. automethod:: Mastodon.account_relationships
1089.. automethod:: Mastodon.account_search 1101.. automethod:: Mastodon.account_search
1090.. automethod:: Mastodon.account_lists
1091.. automethod:: Mastodon.account_lookup 1102.. automethod:: Mastodon.account_lookup
1103.. automethod:: Mastodon.account_lists
1104.. automethod:: Mastodon.account_familiar_followers
1092 1105
1093Reading data: Featured tags 1106Reading data: Featured tags
1094~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1107~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index c3c02a0..9386882 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -459,12 +459,13 @@ class Mastodon:
459 self.api_base_url = try_base_url 459 self.api_base_url = try_base_url
460 460
461 # For EVEN newer vesions, we ALSO ALSO store the client id and secret so that you don't need to reauth to revoke 461 # For EVEN newer vesions, we ALSO ALSO store the client id and secret so that you don't need to reauth to revoke
462 try: 462 if self.client_id is None:
463 self.client_id = token_file.readline().rstrip() 463 try:
464 self.client_secret = token_file.readline().rstrip() 464 self.client_id = token_file.readline().rstrip()
465 except: 465 self.client_secret = token_file.readline().rstrip()
466 pass 466 except:
467 467 pass
468
468 # Verify we have a base URL, protocolize 469 # Verify we have a base URL, protocolize
469 if self.api_base_url is None: 470 if self.api_base_url is None:
470 raise MastodonIllegalArgumentError("API base URL is required.") 471 raise MastodonIllegalArgumentError("API base URL is required.")
@@ -1356,6 +1357,19 @@ class Mastodon:
1356 """ 1357 """
1357 return self.__api_request('GET', '/api/v1/accounts/lookup', self.__generate_params(locals())) 1358 return self.__api_request('GET', '/api/v1/accounts/lookup', self.__generate_params(locals()))
1358 1359
1360 @api_version("3.5.0", "3.5.0", __DICT_VERSION_ACCOUNT)
1361 def account_familiar_followers(self, id):
1362 """
1363 Find followers for the account given by id (can be a list) that also follow the
1364 logged in account.
1365
1366 Returns a list of `familiar follower dicts`_
1367 """
1368 if not isinstance(id, list):
1369 id = [id]
1370 for i in range(len(id)):
1371 id[i] = self.__unpack_id(id[i])
1372 return self.__api_request('GET', '/api/v1/accounts/familiar_followers', {'id': id}, use_json=True)
1359 1373
1360 ### 1374 ###
1361 # Reading data: Featured hashtags 1375 # Reading data: Featured hashtags
diff --git a/tests/cassettes/test_account_familiar_followers.yaml b/tests/cassettes/test_account_familiar_followers.yaml
new file mode 100644
index 0000000..5f290e9
--- /dev/null
+++ b/tests/cassettes/test_account_familiar_followers.yaml
@@ -0,0 +1,474 @@
1interactions:
2- request:
3 body: null
4 headers:
5 Accept:
6 - '*/*'
7 Accept-Encoding:
8 - gzip, deflate
9 Authorization:
10 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
11 Connection:
12 - keep-alive
13 User-Agent:
14 - tests/v311
15 method: GET
16 uri: http://localhost:3000/api/v1/accounts/verify_credentials
17 response:
18 body:
19 string: '{"id":"109411885671340064","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"source":{"privacy":"public","sensitive":false,"language":null,"note":"","fields":[],"follow_requests_count":0},"emojis":[],"fields":[],"role":{"id":"3","name":"Owner","permissions":"1048575","color":"","highlighted":true}}'
20 headers:
21 Cache-Control:
22 - no-store
23 Content-Security-Policy:
24 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
25 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
26 style-src ''self'' http://localhost:3000 ''nonce-HsglxmIP4X9/7gzWNyzBNQ=='';
27 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
28 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
29 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
30 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
31 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
32 worker-src ''self'' blob: http://localhost:3000'
33 Content-Type:
34 - application/json; charset=utf-8
35 ETag:
36 - W/"a92dcb08b6f874d680c45eede3cca2ec"
37 Referrer-Policy:
38 - strict-origin-when-cross-origin
39 Transfer-Encoding:
40 - chunked
41 Vary:
42 - Accept, Origin
43 X-Content-Type-Options:
44 - nosniff
45 X-Download-Options:
46 - noopen
47 X-Frame-Options:
48 - SAMEORIGIN
49 X-Permitted-Cross-Domain-Policies:
50 - none
51 X-Request-Id:
52 - 04a9eb59-b11c-4188-b958-d7dfeb53ae6d
53 X-Runtime:
54 - '0.029692'
55 X-XSS-Protection:
56 - 1; mode=block
57 status:
58 code: 200
59 message: OK
60- request:
61 body: '{"id": [109411885671340064]}'
62 headers:
63 Accept:
64 - '*/*'
65 Accept-Encoding:
66 - gzip, deflate
67 Authorization:
68 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
69 Connection:
70 - keep-alive
71 Content-Length:
72 - '28'
73 Content-Type:
74 - application/json
75 User-Agent:
76 - tests/v311
77 method: GET
78 uri: http://localhost:3000/api/v1/accounts/familiar_followers
79 response:
80 body:
81 string: '[{"id":"109411885671340064","accounts":[]}]'
82 headers:
83 Cache-Control:
84 - no-store
85 Content-Security-Policy:
86 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
87 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
88 style-src ''self'' http://localhost:3000 ''nonce-5j9VM0TO7+8xoit9RncpvA=='';
89 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
90 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
91 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
92 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
93 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
94 worker-src ''self'' blob: http://localhost:3000'
95 Content-Type:
96 - application/json; charset=utf-8
97 ETag:
98 - W/"b97f7c3306068f25d5289e9c8bdd190b"
99 Referrer-Policy:
100 - strict-origin-when-cross-origin
101 Transfer-Encoding:
102 - chunked
103 Vary:
104 - Accept, Origin
105 X-Content-Type-Options:
106 - nosniff
107 X-Download-Options:
108 - noopen
109 X-Frame-Options:
110 - SAMEORIGIN
111 X-Permitted-Cross-Domain-Policies:
112 - none
113 X-Request-Id:
114 - 17dcfa85-da42-4267-b758-06852ec1d5ad
115 X-Runtime:
116 - '0.036562'
117 X-XSS-Protection:
118 - 1; mode=block
119 status:
120 code: 200
121 message: OK
122- request:
123 body: null
124 headers:
125 Accept:
126 - '*/*'
127 Accept-Encoding:
128 - gzip, deflate
129 Authorization:
130 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
131 Connection:
132 - keep-alive
133 User-Agent:
134 - tests/v311
135 method: GET
136 uri: http://localhost:3000/api/v1/accounts/verify_credentials
137 response:
138 body:
139 string: '{"id":"109411885671340064","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"source":{"privacy":"public","sensitive":false,"language":null,"note":"","fields":[],"follow_requests_count":0},"emojis":[],"fields":[],"role":{"id":"3","name":"Owner","permissions":"1048575","color":"","highlighted":true}}'
140 headers:
141 Cache-Control:
142 - no-store
143 Content-Security-Policy:
144 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
145 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
146 style-src ''self'' http://localhost:3000 ''nonce-AqTmg/2+pH5lHD7Nqp5zvA=='';
147 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
148 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
149 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
150 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
151 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
152 worker-src ''self'' blob: http://localhost:3000'
153 Content-Type:
154 - application/json; charset=utf-8
155 ETag:
156 - W/"a92dcb08b6f874d680c45eede3cca2ec"
157 Referrer-Policy:
158 - strict-origin-when-cross-origin
159 Transfer-Encoding:
160 - chunked
161 Vary:
162 - Accept, Origin
163 X-Content-Type-Options:
164 - nosniff
165 X-Download-Options:
166 - noopen
167 X-Frame-Options:
168 - SAMEORIGIN
169 X-Permitted-Cross-Domain-Policies:
170 - none
171 X-Request-Id:
172 - e219b468-eea5-4147-b8b6-f529b78f46a7
173 X-Runtime:
174 - '0.019573'
175 X-XSS-Protection:
176 - 1; mode=block
177 status:
178 code: 200
179 message: OK
180- request:
181 body: null
182 headers:
183 Accept:
184 - '*/*'
185 Accept-Encoding:
186 - gzip, deflate
187 Authorization:
188 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
189 Connection:
190 - keep-alive
191 User-Agent:
192 - tests/v311
193 method: GET
194 uri: http://localhost:3000/api/v1/accounts/verify_credentials
195 response:
196 body:
197 string: '{"id":"109411885671340064","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"source":{"privacy":"public","sensitive":false,"language":null,"note":"","fields":[],"follow_requests_count":0},"emojis":[],"fields":[],"role":{"id":"3","name":"Owner","permissions":"1048575","color":"","highlighted":true}}'
198 headers:
199 Cache-Control:
200 - no-store
201 Content-Security-Policy:
202 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
203 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
204 style-src ''self'' http://localhost:3000 ''nonce-pEDEgC21lzY+5lANf9Y82A=='';
205 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
206 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
207 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
208 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
209 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
210 worker-src ''self'' blob: http://localhost:3000'
211 Content-Type:
212 - application/json; charset=utf-8
213 ETag:
214 - W/"a92dcb08b6f874d680c45eede3cca2ec"
215 Referrer-Policy:
216 - strict-origin-when-cross-origin
217 Transfer-Encoding:
218 - chunked
219 Vary:
220 - Accept, Origin
221 X-Content-Type-Options:
222 - nosniff
223 X-Download-Options:
224 - noopen
225 X-Frame-Options:
226 - SAMEORIGIN
227 X-Permitted-Cross-Domain-Policies:
228 - none
229 X-Request-Id:
230 - cc4eac3a-7f0b-4a9f-9e1e-13746da6e32e
231 X-Runtime:
232 - '0.016836'
233 X-XSS-Protection:
234 - 1; mode=block
235 status:
236 code: 200
237 message: OK
238- request:
239 body: null
240 headers:
241 Accept:
242 - '*/*'
243 Accept-Encoding:
244 - gzip, deflate
245 Authorization:
246 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_3
247 Connection:
248 - keep-alive
249 User-Agent:
250 - tests/v311
251 method: GET
252 uri: http://localhost:3000/api/v1/accounts/verify_credentials
253 response:
254 body:
255 string: '{"id":"109411886050231694","username":"mastodonpy_test_2","acct":"mastodonpy_test_2","display_name":"","locked":false,"bot":false,"discoverable":true,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test_2","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"source":{"privacy":"public","sensitive":false,"language":null,"note":"","fields":[],"follow_requests_count":0},"emojis":[],"fields":[],"role":{"id":"-99","name":"","permissions":"65536","color":"","highlighted":false}}'
256 headers:
257 Cache-Control:
258 - no-store
259 Content-Security-Policy:
260 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
261 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
262 style-src ''self'' http://localhost:3000 ''nonce-xQuOD8nr/iV0EOtUeqpFzw=='';
263 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
264 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
265 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
266 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
267 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
268 worker-src ''self'' blob: http://localhost:3000'
269 Content-Type:
270 - application/json; charset=utf-8
271 ETag:
272 - W/"9b2f5aee7759c56dec7b8052fd486107"
273 Referrer-Policy:
274 - strict-origin-when-cross-origin
275 Transfer-Encoding:
276 - chunked
277 Vary:
278 - Accept, Origin
279 X-Content-Type-Options:
280 - nosniff
281 X-Download-Options:
282 - noopen
283 X-Frame-Options:
284 - SAMEORIGIN
285 X-Permitted-Cross-Domain-Policies:
286 - none
287 X-Request-Id:
288 - 4b007953-7d3a-4ed4-9ec1-c73b57593373
289 X-Runtime:
290 - '0.068161'
291 X-XSS-Protection:
292 - 1; mode=block
293 status:
294 code: 200
295 message: OK
296- request:
297 body: '{"id": [109411885671340064, 109411886050231694]}'
298 headers:
299 Accept:
300 - '*/*'
301 Accept-Encoding:
302 - gzip, deflate
303 Authorization:
304 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
305 Connection:
306 - keep-alive
307 Content-Length:
308 - '48'
309 Content-Type:
310 - application/json
311 User-Agent:
312 - tests/v311
313 method: GET
314 uri: http://localhost:3000/api/v1/accounts/familiar_followers
315 response:
316 body:
317 string: '[{"id":"109411885671340064","accounts":[]},{"id":"109411886050231694","accounts":[]}]'
318 headers:
319 Cache-Control:
320 - no-store
321 Content-Security-Policy:
322 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
323 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
324 style-src ''self'' http://localhost:3000 ''nonce-0rxKBZJV0bQR4XvobxIHsA=='';
325 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
326 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
327 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
328 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
329 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
330 worker-src ''self'' blob: http://localhost:3000'
331 Content-Type:
332 - application/json; charset=utf-8
333 ETag:
334 - W/"7cd1229a63b01fb300cbaaa957e53b53"
335 Referrer-Policy:
336 - strict-origin-when-cross-origin
337 Transfer-Encoding:
338 - chunked
339 Vary:
340 - Accept, Origin
341 X-Content-Type-Options:
342 - nosniff
343 X-Download-Options:
344 - noopen
345 X-Frame-Options:
346 - SAMEORIGIN
347 X-Permitted-Cross-Domain-Policies:
348 - none
349 X-Request-Id:
350 - 24a35cec-aded-4710-9c69-442a5b49852b
351 X-Runtime:
352 - '0.013945'
353 X-XSS-Protection:
354 - 1; mode=block
355 status:
356 code: 200
357 message: OK
358- request:
359 body: null
360 headers:
361 Accept:
362 - '*/*'
363 Accept-Encoding:
364 - gzip, deflate
365 Authorization:
366 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
367 Connection:
368 - keep-alive
369 User-Agent:
370 - tests/v311
371 method: GET
372 uri: http://localhost:3000/api/v1/accounts/verify_credentials
373 response:
374 body:
375 string: '{"id":"109411885671340064","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"source":{"privacy":"public","sensitive":false,"language":null,"note":"","fields":[],"follow_requests_count":0},"emojis":[],"fields":[],"role":{"id":"3","name":"Owner","permissions":"1048575","color":"","highlighted":true}}'
376 headers:
377 Cache-Control:
378 - no-store
379 Content-Security-Policy:
380 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
381 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
382 style-src ''self'' http://localhost:3000 ''nonce-g7eI+n5KW3K5e9BunAxYDw=='';
383 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
384 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
385 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
386 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
387 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
388 worker-src ''self'' blob: http://localhost:3000'
389 Content-Type:
390 - application/json; charset=utf-8
391 ETag:
392 - W/"a92dcb08b6f874d680c45eede3cca2ec"
393 Referrer-Policy:
394 - strict-origin-when-cross-origin
395 Transfer-Encoding:
396 - chunked
397 Vary:
398 - Accept, Origin
399 X-Content-Type-Options:
400 - nosniff
401 X-Download-Options:
402 - noopen
403 X-Frame-Options:
404 - SAMEORIGIN
405 X-Permitted-Cross-Domain-Policies:
406 - none
407 X-Request-Id:
408 - 135538ed-c3cc-4971-9dfc-a76caf6e9c49
409 X-Runtime:
410 - '0.017874'
411 X-XSS-Protection:
412 - 1; mode=block
413 status:
414 code: 200
415 message: OK
416- request:
417 body: null
418 headers:
419 Accept:
420 - '*/*'
421 Accept-Encoding:
422 - gzip, deflate
423 Authorization:
424 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_3
425 Connection:
426 - keep-alive
427 User-Agent:
428 - tests/v311
429 method: GET
430 uri: http://localhost:3000/api/v1/accounts/verify_credentials
431 response:
432 body:
433 string: '{"id":"109411886050231694","username":"mastodonpy_test_2","acct":"mastodonpy_test_2","display_name":"","locked":false,"bot":false,"discoverable":true,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test_2","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"source":{"privacy":"public","sensitive":false,"language":null,"note":"","fields":[],"follow_requests_count":0},"emojis":[],"fields":[],"role":{"id":"-99","name":"","permissions":"65536","color":"","highlighted":false}}'
434 headers:
435 Cache-Control:
436 - no-store
437 Content-Security-Policy:
438 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
439 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
440 style-src ''self'' http://localhost:3000 ''nonce-1ZPdVwRxFGNenU8svTXCJw=='';
441 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
442 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
443 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
444 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
445 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
446 worker-src ''self'' blob: http://localhost:3000'
447 Content-Type:
448 - application/json; charset=utf-8
449 ETag:
450 - W/"9b2f5aee7759c56dec7b8052fd486107"
451 Referrer-Policy:
452 - strict-origin-when-cross-origin
453 Transfer-Encoding:
454 - chunked
455 Vary:
456 - Accept, Origin
457 X-Content-Type-Options:
458 - nosniff
459 X-Download-Options:
460 - noopen
461 X-Frame-Options:
462 - SAMEORIGIN
463 X-Permitted-Cross-Domain-Policies:
464 - none
465 X-Request-Id:
466 - 57c760f3-1384-464d-a8e1-93e054a2076c
467 X-Runtime:
468 - '0.018550'
469 X-XSS-Protection:
470 - 1; mode=block
471 status:
472 code: 200
473 message: OK
474version: 1
diff --git a/tests/test_account.py b/tests/test_account.py
index be48646..184e346 100644
--- a/tests/test_account.py
+++ b/tests/test_account.py
@@ -290,4 +290,18 @@ def test_account_lookup(api, api3):
290 except: 290 except:
291 pass 291 pass
292 assert(api.account_lookup("mastodonpy_test").id == id) 292 assert(api.account_lookup("mastodonpy_test").id == id)
293 assert(api.account_lookup("mastodonpy_test@localhost:3000").id == id) \ No newline at end of file 293 assert(api.account_lookup("mastodonpy_test@localhost:3000").id == id)
294
295@pytest.mark.vcr()
296def test_account_familiar_followers(api, api2, api3):
297 followers_list = api.account_familiar_followers(api2.me())
298 assert followers_list
299 assert len(followers_list) == 1
300 assert followers_list[0].id == api2.me().id
301 assert "accounts" in followers_list[0]
302
303 followers_list = api.account_familiar_followers([api2.me(), api3.me()])
304 assert followers_list
305 assert len(followers_list) == 2
306 assert followers_list[0].id == api2.me().id
307 assert followers_list[1].id == api3.me().id
Powered by cgit v1.2.3 (git 2.41.0)