kopia lustrzana https://github.com/halcy/Mastodon.py
Add remove_from_followers
rodzic
b35e3f3da8
commit
ae9f764087
|
@ -16,6 +16,7 @@ v1.8.0 (in progress)
|
|||
* Added the stats admin APIs (`admin_measures`, `admin_dimensions`, `admin_retention`)
|
||||
* Added client auth data to access token file.
|
||||
* Added `account_familiar_followers` API
|
||||
* Added `account_remove_from_followers` API
|
||||
|
||||
v1.7.0
|
||||
------
|
||||
|
|
2
TODO.md
2
TODO.md
|
@ -46,7 +46,7 @@ Refer to mastodon changelog and API docs for details when implementing, add or m
|
|||
* [x] Add explore page with trending posts and links
|
||||
* [x] Add graphs and retention metrics to admin dashboard
|
||||
* [x] Add GET /api/v1/accounts/familiar_followers to REST API
|
||||
* [ ] Add POST /api/v1/accounts/:id/remove_from_followers to REST API
|
||||
* [x] Add POST /api/v1/accounts/:id/remove_from_followers to REST API
|
||||
* [x] Add category and rule_ids params to POST /api/v1/reports IN REST API
|
||||
* [x] Add global lang param to REST API
|
||||
* [x] Add types param to GET /api/v1/notifications in REST API
|
||||
|
|
|
@ -1102,6 +1102,7 @@ their relationships.
|
|||
.. automethod:: Mastodon.account_lookup
|
||||
.. automethod:: Mastodon.account_lists
|
||||
.. automethod:: Mastodon.account_familiar_followers
|
||||
.. automethod:: Mastodon.account_remove_from_followers
|
||||
|
||||
Reading data: Featured tags
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -40,7 +40,6 @@ try:
|
|||
except:
|
||||
IMPL_HAS_ECE = False
|
||||
|
||||
|
||||
IMPL_HAS_BLURHASH = True
|
||||
try:
|
||||
import blurhash
|
||||
|
@ -262,6 +261,7 @@ class Mastodon:
|
|||
__DICT_VERSION_REACTION = "3.1.0"
|
||||
__DICT_VERSION_ANNOUNCEMENT = bigger_version("3.1.0", __DICT_VERSION_REACTION)
|
||||
__DICT_VERSION_STATUS_EDIT = "3.5.0"
|
||||
__DICT_VERSION_FAMILIAR_FOLLOWERS = bigger_version("3.5.0", __DICT_VERSION_ACCOUNT)
|
||||
__DICT_VERSION_ADMIN_DOMAIN_BLOCK = "4.0.0"
|
||||
__DICT_VERSION_ADMIN_MEASURE = "3.5.0"
|
||||
__DICT_VERSION_ADMIN_DIMENSION = "3.5.0"
|
||||
|
@ -1357,7 +1357,7 @@ class Mastodon:
|
|||
"""
|
||||
return self.__api_request('GET', '/api/v1/accounts/lookup', self.__generate_params(locals()))
|
||||
|
||||
@api_version("3.5.0", "3.5.0", __DICT_VERSION_ACCOUNT)
|
||||
@api_version("3.5.0", "3.5.0", __DICT_VERSION_FAMILIAR_FOLLOWERS)
|
||||
def account_familiar_followers(self, id):
|
||||
"""
|
||||
Find followers for the account given by id (can be a list) that also follow the
|
||||
|
@ -2457,8 +2457,19 @@ class Mastodon:
|
|||
Returns a `relationship dict`_ containing the updated relationship to the user.
|
||||
"""
|
||||
id = self.__unpack_id(id)
|
||||
url = '/api/v1/accounts/{0}/unfollow'.format(str(id))
|
||||
return self.__api_request('POST', url)
|
||||
return self.__api_request('POST', '/api/v1/accounts/{0}/unfollow'.format(str(id)))
|
||||
|
||||
@api_version("3.5.0", "3.5.0", __DICT_VERSION_RELATIONSHIP)
|
||||
def account_remove_from_followers(self, id):
|
||||
"""
|
||||
Remove a user from the logged in users followers (i.e. make them unfollow the logged in
|
||||
user / "softblock" them).
|
||||
|
||||
Returns a `relationship dict`_ reflecting the updated following status.
|
||||
"""
|
||||
id = self.__unpack_id(id)
|
||||
return self.__api_request('POST', '/api/v1/accounts/{0}/remove_from_followers'.format(str(id)))
|
||||
|
||||
|
||||
@api_version("1.0.0", "1.4.0", __DICT_VERSION_RELATIONSHIP)
|
||||
def account_block(self, id):
|
||||
|
@ -3618,16 +3629,14 @@ class Mastodon:
|
|||
raise NotImplementedError(
|
||||
'To use the crypto tools, please install the webpush feature dependencies.')
|
||||
|
||||
push_key_pair = ec.generate_private_key(
|
||||
ec.SECP256R1(), default_backend())
|
||||
push_key_pair = ec.generate_private_key(ec.SECP256R1(), default_backend())
|
||||
push_key_priv = push_key_pair.private_numbers().private_value
|
||||
|
||||
crypto_ver = cryptography.__version__
|
||||
if len(crypto_ver) < 5:
|
||||
crypto_ver += ".0"
|
||||
if bigger_version(crypto_ver, "2.5.0") == crypto_ver:
|
||||
push_key_pub = push_key_pair.public_key().public_bytes(
|
||||
serialization.Encoding.X962, serialization.PublicFormat.UncompressedPoint)
|
||||
push_key_pub = push_key_pair.public_key().public_bytes(serialization.Encoding.X962, serialization.PublicFormat.UncompressedPoint)
|
||||
else:
|
||||
push_key_pub = push_key_pair.public_key().public_numbers().encode_point()
|
||||
push_shared_secret = os.urandom(16)
|
||||
|
@ -3657,14 +3666,10 @@ class Mastodon:
|
|||
raise NotImplementedError(
|
||||
'To use the crypto tools, please install the webpush feature dependencies.')
|
||||
|
||||
salt = self.__decode_webpush_b64(
|
||||
encryption_header.split("salt=")[1].strip())
|
||||
dhparams = self.__decode_webpush_b64(
|
||||
crypto_key_header.split("dh=")[1].split(";")[0].strip())
|
||||
p256ecdsa = self.__decode_webpush_b64(
|
||||
crypto_key_header.split("p256ecdsa=")[1].strip())
|
||||
dec_key = ec.derive_private_key(
|
||||
decrypt_params['privkey'], ec.SECP256R1(), default_backend())
|
||||
salt = self.__decode_webpush_b64(encryption_header.split("salt=")[1].strip())
|
||||
dhparams = self.__decode_webpush_b64(crypto_key_header.split("dh=")[1].split(";")[0].strip())
|
||||
p256ecdsa = self.__decode_webpush_b64(crypto_key_header.split("p256ecdsa=")[1].strip())
|
||||
dec_key = ec.derive_private_key(decrypt_params['privkey'], ec.SECP256R1(), default_backend())
|
||||
decrypted = http_ece.decrypt(
|
||||
data,
|
||||
salt=salt,
|
||||
|
@ -3703,8 +3708,7 @@ class Mastodon:
|
|||
'To use the blurhash functions, please install the blurhash Python module.')
|
||||
|
||||
# Figure out what size to decode to
|
||||
decode_components_x, decode_components_y = blurhash.components(
|
||||
media_dict["blurhash"])
|
||||
decode_components_x, decode_components_y = blurhash.components(media_dict["blurhash"])
|
||||
if size_per_component:
|
||||
decode_size_x = decode_components_x * out_size[0]
|
||||
decode_size_y = decode_components_y * out_size[1]
|
||||
|
@ -3713,8 +3717,7 @@ class Mastodon:
|
|||
decode_size_y = out_size[1]
|
||||
|
||||
# Decode
|
||||
decoded_image = blurhash.decode(
|
||||
media_dict["blurhash"], decode_size_x, decode_size_y, linear=return_linear)
|
||||
decoded_image = blurhash.decode(media_dict["blurhash"], decode_size_x, decode_size_y, linear=return_linear)
|
||||
|
||||
# And that's pretty much it.
|
||||
return decoded_image
|
||||
|
|
|
@ -0,0 +1,478 @@
|
|||
interactions:
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- '*/*'
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
|
||||
Connection:
|
||||
- keep-alive
|
||||
User-Agent:
|
||||
- tests/v311
|
||||
method: GET
|
||||
uri: http://localhost:3000/api/v1/accounts/verify_credentials
|
||||
response:
|
||||
body:
|
||||
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}}'
|
||||
headers:
|
||||
Cache-Control:
|
||||
- no-store
|
||||
Content-Security-Policy:
|
||||
- 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
|
||||
''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
|
||||
style-src ''self'' http://localhost:3000 ''nonce-R0dOyCBcX1yy1m5FC+QBeg=='';
|
||||
media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
|
||||
https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
|
||||
data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
|
||||
ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
|
||||
''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
|
||||
worker-src ''self'' blob: http://localhost:3000'
|
||||
Content-Type:
|
||||
- application/json; charset=utf-8
|
||||
ETag:
|
||||
- W/"a92dcb08b6f874d680c45eede3cca2ec"
|
||||
Referrer-Policy:
|
||||
- strict-origin-when-cross-origin
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Vary:
|
||||
- Accept, Origin
|
||||
X-Content-Type-Options:
|
||||
- nosniff
|
||||
X-Download-Options:
|
||||
- noopen
|
||||
X-Frame-Options:
|
||||
- SAMEORIGIN
|
||||
X-Permitted-Cross-Domain-Policies:
|
||||
- none
|
||||
X-Request-Id:
|
||||
- 3cb66a54-d7b2-41d3-9286-d7a3408ef1a3
|
||||
X-Runtime:
|
||||
- '0.020531'
|
||||
X-XSS-Protection:
|
||||
- 1; mode=block
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: reblogs=1¬ify=0
|
||||
headers:
|
||||
Accept:
|
||||
- '*/*'
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '18'
|
||||
Content-Type:
|
||||
- application/x-www-form-urlencoded
|
||||
User-Agent:
|
||||
- tests/v311
|
||||
method: POST
|
||||
uri: http://localhost:3000/api/v1/accounts/109411885671340064/follow
|
||||
response:
|
||||
body:
|
||||
string: '{"id":"109411885671340064","following":true,"showing_reblogs":true,"notifying":false,"languages":null,"followed_by":false,"blocking":false,"blocked_by":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false,"endorsed":false,"note":""}'
|
||||
headers:
|
||||
Cache-Control:
|
||||
- no-store
|
||||
Content-Security-Policy:
|
||||
- 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
|
||||
''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
|
||||
style-src ''self'' http://localhost:3000 ''nonce-+BjRNgT24KKtrEiWOEtFJQ=='';
|
||||
media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
|
||||
https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
|
||||
data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
|
||||
ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
|
||||
''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
|
||||
worker-src ''self'' blob: http://localhost:3000'
|
||||
Content-Type:
|
||||
- application/json; charset=utf-8
|
||||
ETag:
|
||||
- W/"af292124c7f7757a6ec996d381b1428e"
|
||||
Referrer-Policy:
|
||||
- strict-origin-when-cross-origin
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Vary:
|
||||
- Accept, Origin
|
||||
X-Content-Type-Options:
|
||||
- nosniff
|
||||
X-Download-Options:
|
||||
- noopen
|
||||
X-Frame-Options:
|
||||
- SAMEORIGIN
|
||||
X-Permitted-Cross-Domain-Policies:
|
||||
- none
|
||||
X-RateLimit-Limit:
|
||||
- '400'
|
||||
X-RateLimit-Remaining:
|
||||
- '398'
|
||||
X-RateLimit-Reset:
|
||||
- '2022-11-28T00:00:00.639846Z'
|
||||
X-Request-Id:
|
||||
- b8962ba9-f875-4975-97bb-df94b6eb4ffc
|
||||
X-Runtime:
|
||||
- '0.043218'
|
||||
X-XSS-Protection:
|
||||
- 1; mode=block
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- '*/*'
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
|
||||
Connection:
|
||||
- keep-alive
|
||||
User-Agent:
|
||||
- tests/v311
|
||||
method: GET
|
||||
uri: http://localhost:3000/api/v1/accounts/verify_credentials
|
||||
response:
|
||||
body:
|
||||
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":1,"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}}'
|
||||
headers:
|
||||
Cache-Control:
|
||||
- no-store
|
||||
Content-Security-Policy:
|
||||
- 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
|
||||
''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
|
||||
style-src ''self'' http://localhost:3000 ''nonce-sOq1lKB5A0ber9S6v+u7DA=='';
|
||||
media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
|
||||
https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
|
||||
data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
|
||||
ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
|
||||
''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
|
||||
worker-src ''self'' blob: http://localhost:3000'
|
||||
Content-Type:
|
||||
- application/json; charset=utf-8
|
||||
ETag:
|
||||
- W/"defdf16b9376bb51a9a69e6d6a5d3ab8"
|
||||
Referrer-Policy:
|
||||
- strict-origin-when-cross-origin
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Vary:
|
||||
- Accept, Origin
|
||||
X-Content-Type-Options:
|
||||
- nosniff
|
||||
X-Download-Options:
|
||||
- noopen
|
||||
X-Frame-Options:
|
||||
- SAMEORIGIN
|
||||
X-Permitted-Cross-Domain-Policies:
|
||||
- none
|
||||
X-Request-Id:
|
||||
- 150cfa42-bd36-4a82-9b22-b14db3938024
|
||||
X-Runtime:
|
||||
- '0.016869'
|
||||
X-XSS-Protection:
|
||||
- 1; mode=block
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- '*/*'
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
|
||||
Connection:
|
||||
- keep-alive
|
||||
User-Agent:
|
||||
- tests/v311
|
||||
method: GET
|
||||
uri: http://localhost:3000/api/v1/accounts/relationships?id=109411885671340064
|
||||
response:
|
||||
body:
|
||||
string: '[{"id":"109411885671340064","following":true,"showing_reblogs":true,"notifying":false,"languages":null,"followed_by":false,"blocking":false,"blocked_by":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false,"endorsed":false,"note":""}]'
|
||||
headers:
|
||||
Cache-Control:
|
||||
- no-store
|
||||
Content-Security-Policy:
|
||||
- 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
|
||||
''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
|
||||
style-src ''self'' http://localhost:3000 ''nonce-S2ETIreO4os8h47eriy+PA=='';
|
||||
media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
|
||||
https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
|
||||
data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
|
||||
ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
|
||||
''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
|
||||
worker-src ''self'' blob: http://localhost:3000'
|
||||
Content-Type:
|
||||
- application/json; charset=utf-8
|
||||
ETag:
|
||||
- W/"e8e7c78d4d5bca66b2af884722eb658b"
|
||||
Referrer-Policy:
|
||||
- strict-origin-when-cross-origin
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Vary:
|
||||
- Accept, Origin
|
||||
X-Content-Type-Options:
|
||||
- nosniff
|
||||
X-Download-Options:
|
||||
- noopen
|
||||
X-Frame-Options:
|
||||
- SAMEORIGIN
|
||||
X-Permitted-Cross-Domain-Policies:
|
||||
- none
|
||||
X-Request-Id:
|
||||
- ad0bc94a-d5d5-476f-a8eb-52aa8d9a9227
|
||||
X-Runtime:
|
||||
- '0.014908'
|
||||
X-XSS-Protection:
|
||||
- 1; mode=block
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- '*/*'
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
|
||||
Connection:
|
||||
- keep-alive
|
||||
User-Agent:
|
||||
- tests/v311
|
||||
method: GET
|
||||
uri: http://localhost:3000/api/v1/accounts/verify_credentials
|
||||
response:
|
||||
body:
|
||||
string: '{"id":"109411885927532888","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test","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":1,"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}}'
|
||||
headers:
|
||||
Cache-Control:
|
||||
- no-store
|
||||
Content-Security-Policy:
|
||||
- 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
|
||||
''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
|
||||
style-src ''self'' http://localhost:3000 ''nonce-+NtKlOuZVkU8Acusia2Htw=='';
|
||||
media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
|
||||
https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
|
||||
data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
|
||||
ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
|
||||
''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
|
||||
worker-src ''self'' blob: http://localhost:3000'
|
||||
Content-Type:
|
||||
- application/json; charset=utf-8
|
||||
ETag:
|
||||
- W/"17970f44d54945f9f38ba671d9d60356"
|
||||
Referrer-Policy:
|
||||
- strict-origin-when-cross-origin
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Vary:
|
||||
- Accept, Origin
|
||||
X-Content-Type-Options:
|
||||
- nosniff
|
||||
X-Download-Options:
|
||||
- noopen
|
||||
X-Frame-Options:
|
||||
- SAMEORIGIN
|
||||
X-Permitted-Cross-Domain-Policies:
|
||||
- none
|
||||
X-Request-Id:
|
||||
- 74be946f-6e21-4ab1-b9df-5cde9dea3ea0
|
||||
X-Runtime:
|
||||
- '0.016156'
|
||||
X-XSS-Protection:
|
||||
- 1; mode=block
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- '*/*'
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '0'
|
||||
User-Agent:
|
||||
- tests/v311
|
||||
method: POST
|
||||
uri: http://localhost:3000/api/v1/accounts/109411885927532888/remove_from_followers
|
||||
response:
|
||||
body:
|
||||
string: '{"id":"109411885927532888","following":false,"showing_reblogs":false,"notifying":false,"languages":null,"followed_by":false,"blocking":false,"blocked_by":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false,"endorsed":false,"note":""}'
|
||||
headers:
|
||||
Cache-Control:
|
||||
- no-store
|
||||
Content-Security-Policy:
|
||||
- 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
|
||||
''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
|
||||
style-src ''self'' http://localhost:3000 ''nonce-I3WirYh4zIJil4fz4Ypvuw=='';
|
||||
media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
|
||||
https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
|
||||
data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
|
||||
ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
|
||||
''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
|
||||
worker-src ''self'' blob: http://localhost:3000'
|
||||
Content-Type:
|
||||
- application/json; charset=utf-8
|
||||
ETag:
|
||||
- W/"cafa36e073f0abd1d761a2481756af20"
|
||||
Referrer-Policy:
|
||||
- strict-origin-when-cross-origin
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Vary:
|
||||
- Accept, Origin
|
||||
X-Content-Type-Options:
|
||||
- nosniff
|
||||
X-Download-Options:
|
||||
- noopen
|
||||
X-Frame-Options:
|
||||
- SAMEORIGIN
|
||||
X-Permitted-Cross-Domain-Policies:
|
||||
- none
|
||||
X-Request-Id:
|
||||
- f87c5171-28c0-4376-8fa8-b9dd0ae5f1e1
|
||||
X-Runtime:
|
||||
- '0.023087'
|
||||
X-XSS-Protection:
|
||||
- 1; mode=block
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- '*/*'
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
|
||||
Connection:
|
||||
- keep-alive
|
||||
User-Agent:
|
||||
- tests/v311
|
||||
method: GET
|
||||
uri: http://localhost:3000/api/v1/accounts/verify_credentials
|
||||
response:
|
||||
body:
|
||||
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}}'
|
||||
headers:
|
||||
Cache-Control:
|
||||
- no-store
|
||||
Content-Security-Policy:
|
||||
- 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
|
||||
''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
|
||||
style-src ''self'' http://localhost:3000 ''nonce-6VHUdI/c1cfanzBNaHf3CA=='';
|
||||
media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
|
||||
https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
|
||||
data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
|
||||
ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
|
||||
''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
|
||||
worker-src ''self'' blob: http://localhost:3000'
|
||||
Content-Type:
|
||||
- application/json; charset=utf-8
|
||||
ETag:
|
||||
- W/"a92dcb08b6f874d680c45eede3cca2ec"
|
||||
Referrer-Policy:
|
||||
- strict-origin-when-cross-origin
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Vary:
|
||||
- Accept, Origin
|
||||
X-Content-Type-Options:
|
||||
- nosniff
|
||||
X-Download-Options:
|
||||
- noopen
|
||||
X-Frame-Options:
|
||||
- SAMEORIGIN
|
||||
X-Permitted-Cross-Domain-Policies:
|
||||
- none
|
||||
X-Request-Id:
|
||||
- bdcd3a80-4ad7-48f1-acbb-7841dccaf9cd
|
||||
X-Runtime:
|
||||
- '0.015990'
|
||||
X-XSS-Protection:
|
||||
- 1; mode=block
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- '*/*'
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
|
||||
Connection:
|
||||
- keep-alive
|
||||
User-Agent:
|
||||
- tests/v311
|
||||
method: GET
|
||||
uri: http://localhost:3000/api/v1/accounts/relationships?id=109411885671340064
|
||||
response:
|
||||
body:
|
||||
string: '[{"id":"109411885671340064","following":false,"showing_reblogs":false,"notifying":false,"languages":null,"followed_by":false,"blocking":false,"blocked_by":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false,"endorsed":false,"note":""}]'
|
||||
headers:
|
||||
Cache-Control:
|
||||
- no-store
|
||||
Content-Security-Policy:
|
||||
- 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
|
||||
''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
|
||||
style-src ''self'' http://localhost:3000 ''nonce-tRCVlnmRrPBbrJTyH85B4w=='';
|
||||
media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
|
||||
https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
|
||||
data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
|
||||
ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
|
||||
''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
|
||||
worker-src ''self'' blob: http://localhost:3000'
|
||||
Content-Type:
|
||||
- application/json; charset=utf-8
|
||||
ETag:
|
||||
- W/"e0ec461bb1e1fc6ba00e167394f26490"
|
||||
Referrer-Policy:
|
||||
- strict-origin-when-cross-origin
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Vary:
|
||||
- Accept, Origin
|
||||
X-Content-Type-Options:
|
||||
- nosniff
|
||||
X-Download-Options:
|
||||
- noopen
|
||||
X-Frame-Options:
|
||||
- SAMEORIGIN
|
||||
X-Permitted-Cross-Domain-Policies:
|
||||
- none
|
||||
X-Request-Id:
|
||||
- e869b74d-9f48-4b05-8fdc-a33cb6d82924
|
||||
X-Runtime:
|
||||
- '0.012606'
|
||||
X-XSS-Protection:
|
||||
- 1; mode=block
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
version: 1
|
|
@ -33,7 +33,6 @@ def test_account_relationships(api):
|
|||
assert isinstance(relationships, list)
|
||||
assert len(relationships) == 1
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
def test_account_search(api):
|
||||
results = api.account_search('admin')
|
||||
|
@ -305,3 +304,10 @@ def test_account_familiar_followers(api, api2, api3):
|
|||
assert len(followers_list) == 2
|
||||
assert followers_list[0].id == api2.me().id
|
||||
assert followers_list[1].id == api3.me().id
|
||||
|
||||
@pytest.mark.vcr()
|
||||
def test_account_remove_from_followers(api, api2):
|
||||
api.account_follow(api2.me())
|
||||
assert api.account_relationships(api2.me())[0].following == True
|
||||
api2.account_remove_from_followers(api.me())
|
||||
assert api.account_relationships(api2.me())[0].following == False
|
Ładowanie…
Reference in New Issue