Gráfico de commits

347 commits

Autor SHA1 Mensaje Fecha
Lorenz Diener
351d302531
Merge pull request #158 from lefherz/master
New exception class if server is malconfigured, e.g. 502
2019-04-27 17:23:46 +02:00
Lorenz Diener
a264154073
Merge pull request #164 from codl/link-flakeid
more robust handling of pagination Link headers
2019-04-27 17:20:20 +02:00
codl
eca31ea732
improve link header parameter extraction regex 2019-04-15 14:26:43 +02:00
codl
62a47f4e92
oops. str.is_digit() -> str.isdigit() 2019-04-15 14:19:45 +02:00
codl
ad96297a06
more robust handling of pagination Link headers
during a cursory investigation for #163 I found that the code handling
Link headers would not handle non-numeric post IDs like pleroma's
flakeIDs correctly

IDs starting with a number would be truncated to the first non-digit,
and IDs not starting with a number would throw. Thankfully, all flakeIDs
generated so far start with 9. Maybe 8 for the earliest ones, I'm not
sure. Either way, so far it would only have misbehaved when using the
pagination functions or accessing the _pagination_prev and
_pagination_next attributes directly
2019-04-15 03:31:09 +02:00
codl
0666bdabf1
better handling of non-standard error responses, such as from pleroma 2019-03-11 14:51:11 +01:00
lefherz
280973661d New exception class if server is malconfigured, e.g. 502 2019-02-03 01:58:59 +01:00
Jason McBrayer
da9bdb4dbb Add 'content_type' parameter to status_post() for use with Pleroma
This parameter lets you specify the source content type of your post for Pleroma servers, and
accepts 'text/plain', 'text/markdown', and 'text/html'. It defaults to None, but if set on
a request to a Mastodon server, it will be safely ignored.
2019-01-24 10:06:33 -05:00
Lorenz Diener
8b86269787
Merge pull request #151 from jrabbit/seven_proxies
Made Session support more robust and added support to .create_app()
2018-11-26 11:47:21 +01:00
Lorenz Diener
9c5c5b85cc Make filter application regex use raw strings 2018-11-26 11:44:13 +01:00
Lorenz Diener
d1717be251 Fix media is-file check 2018-11-26 11:42:19 +01:00
Lorenz Diener
ae9640e95d
Merge pull request #150 from jfmcbrayer/mime-magic
Use python-magic to determine mime types from contents
2018-11-26 11:24:35 +01:00
Jack Laxson
975145ada6 Made Session support more robust and added support to .create_app() 2018-11-18 04:55:04 -05:00
Jason McBrayer
4b7bbe72cd Use magic for guessing mime type if available
Replace uses of mimetypes.guess_type with guess_type wrapper that uses
magic if available, and falls back to mimetypes if not.
2018-11-12 10:04:15 -05:00
Jason McBrayer
7e2259e3ee Add requirement for python-magic, and add wrappers to Mastodon.py 2018-11-12 09:44:57 -05:00
errbufferoverfl
aabbfa86bf Adds statement to open file if MIME type is set and file exists 2018-09-14 17:16:12 +10:00
Lorenz Diener
2d81e9b2cb Add filter tests 2018-07-30 23:08:30 +02:00
Lorenz Diener
d04b3da7d5 Add filter applies function 2018-07-30 22:09:14 +02:00
Lorenz Diener
ba3c2a8605 Add follow suggestions test 2018-07-30 21:14:40 +02:00
Lorenz Diener
5148658d9a Add test for status_reply 2018-07-30 21:00:20 +02:00
Lorenz Diener
2af3fd82f4 Improve documentation for status_reply 2018-07-30 20:45:26 +02:00
Lorenz Diener
053d8f3b4f Add "untag" parameter to status_reply 2018-07-30 20:44:25 +02:00
Lorenz Diener
087fb249da Fix tests 2018-07-30 20:25:25 +02:00
Lorenz Diener
58c508a11c Bump supported version 2018-07-30 17:30:46 +02:00
Lorenz Diener
de0d5df861 Add keyword filters 2018-07-30 17:29:37 +02:00
Lorenz Diener
cf2d0ebc82 Add follow suggestions 2018-07-30 16:20:56 +02:00
Lorenz Diener
b5f722cd3d Add trendint API 2018-07-30 15:44:09 +02:00
Lorenz Diener
5576c190ad Search v2 2018-07-30 15:38:51 +02:00
Lorenz Diener
3f91aaf1ea Fix version typo 2018-07-30 15:36:31 +02:00
Lorenz Diener
f864bea4e5 Document hashtag history dicts 2018-07-30 15:35:36 +02:00
Lorenz Diener
d3594572bb Add direct language specification 2018-07-30 15:22:11 +02:00
Lorenz Diener
da859de457 Muting / Hide Reblogs changes 2018-07-30 15:16:46 +02:00
Lorenz Diener
1a6293db44 Update documentation for search() 2018-07-30 14:49:25 +02:00
Lorenz Diener
d1a3277a8b Add status_reply, closes #140 2018-07-30 14:37:20 +02:00
Lorenz Diener
4f3deac968 2.4.3 support: Scopes 2018-07-30 13:35:29 +02:00
Lorenz Diener
82cc87b49b Fix #138 2018-07-14 01:02:37 +02:00
D Anzorge
4319283bcd log_in(): check if granted scopes are a superset of requested
Currently, Pleroma does not actually have scopes, but grants "read write
follow" in all cases. For compatibility, log_in() now checks if the
granted scopes include all of the requested scopes, instead of checking
if they match exactly.
2018-06-26 14:48:59 +02:00
Lorenz Diener
01e52ccd8f Add push tests 2018-06-05 22:52:18 +02:00
Lorenz Diener
18c6b3b90f New casettes, small fixes 2018-06-05 22:10:31 +02:00
Lorenz Diener
b08c05e6de Fix specifying only access token 2018-06-05 17:57:22 +02:00
Lorenz Diener
256037f272 Small test fix 2018-06-05 17:47:26 +02:00
Lorenz Diener
fd21e573e3 Merge branch 'master' of https://github.com/halcy/Mastodon.py 2018-06-05 17:37:44 +02:00
Lorenz Diener
caba9c5467 Add notif dict docs 2018-06-05 17:19:15 +02:00
Lorenz Diener
0ded906338
Fix doc typo 2018-06-05 14:43:47 +02:00
Lorenz Diener
4b747886b9 Improve docs 2018-06-05 14:30:47 +02:00
Lorenz Diener
392dd3d61d Add webpush support 2018-06-05 14:10:53 +02:00
Lorenz Diener
85ca599935 Add fields support, tests 2018-06-05 01:54:12 +02:00
Lorenz Diener
2b08e2ec83 Fix py2 compat 2018-06-04 19:56:46 +02:00
Lorenz Diener
163fd5d3d5 Move pagination info to attributes 2018-06-04 16:48:20 +02:00
Lorenz Diener
093c207292 Add idempotency keys, documentation improvements 2018-06-04 15:40:26 +02:00
Lorenz Diener
620687a079 Add pinning/unpinning, media_update 2018-06-04 14:54:26 +02:00
Théo Le Calvar
1090d7476f Fix optional args in account_update_credentials
avatar and header are now correctly ignored if not specified.
2018-05-20 12:55:25 +02:00
Théo Le Calvar
1800a9b2c1 Fix typo in account_update_credentials
Mime type of avatar was used to guess extension of header.
2018-05-20 12:53:19 +02:00
Joel Gil Leon
8052b04446 update constructor to support access_token only 2018-05-19 16:04:15 +03:00
Lorenz Diener
8d5fe70c7e Fix some bugs, update tests 2018-05-07 00:53:13 +02:00
Lorenz Diener
c0a0c8f517 Add focal points 2018-05-06 18:00:07 +02:00
Lorenz Diener
d633df28f7 Add only_media parameter to timelines 2018-05-06 17:46:23 +02:00
Lorenz Diener
ca0ea36c6e
Merge branch 'master' into stream-timeout 2018-05-06 15:55:32 +02:00
Lorenz Diener
ba2fccc1cf Add lists tests and fix a bug 2018-05-06 15:42:38 +02:00
Lorenz Diener
4088e16dec Fix daemonization in python 2 2018-05-06 01:45:02 +02:00
Lorenz Diener
ad6b8eeb04 Switch to using requests Session objects 2018-05-06 01:36:48 +02:00
codl
06e32c14bc
raise MastodonReadTimeout when a stream times out 2018-04-19 17:10:42 +02:00
Lorenz Diener
a825905b57 Fix several bugs 2018-04-18 21:56:36 +02:00
Lorenz Diener
a1ecd2d664 Raise last changed version on instance() 2018-04-17 18:02:55 +02:00
Lorenz Diener
5f44998dd2 First steps to 2.3.0 support 2018-04-17 17:49:08 +02:00
Lorenz Diener
78d3b3a5df Fix for the fix 2018-04-17 17:24:46 +02:00
Lorenz Diener
087c49b199 Small fix to account_search 2018-04-17 17:21:16 +02:00
Lorenz Diener
2afc50c803
Merge branch 'master' into stream-timeout 2018-04-17 16:06:00 +02:00
Lorenz Diener
864c83fa2f Rename async to run_async, fixes #120 2018-04-17 15:38:21 +02:00
Lorenz Diener
eb336a30c2 Add is_receiving: 2018-04-17 14:59:45 +02:00
Lorenz Diener
6d4490295a Nicen up reconnect waiting 2018-04-17 14:55:31 +02:00
Lorenz Diener
d0ae9dcd05 Add async autoreconnect 2018-04-17 14:35:09 +02:00
codl
06a7a875fe
add timeouts to streams (GH-127) 2018-04-08 23:07:08 +02:00
Robert Mock
365ebf3ad9
Fix 500 from status_post capitalized visibilities
The validator for the 'visibility' parameter lower()s it before verifying, but this means that "direct", "Direct", and "dIRECT" all pass validation. However, passing in 'Direct' (at least, to my instance) throws `mastodon.Mastodon.MastodonAPIError: ('Mastodon API returned error', 500, 'Internal Server Error', None)`. This corrects the parameter in-place.
2018-02-11 15:30:58 -08:00
Noëlle Anthony
dd587bb403
Update Mastodon.py
Modified docstring slightly; added type checking for media_ids in the status_post() method. If media_ids is not a list or tuple, put it into a list before parsing it.
2018-02-02 13:46:47 -05:00
Noëlle Anthony
83daab6e31
Update Mastodon.py documentation for status_post()
Updated the docstring for the status_post method to more clearly indicate that the *media_id* argument must be a list even when passing in media dicts returned by *media_post*. (This inclarity cost me quite a bit of debugging this evening.)
2018-02-01 18:57:59 -05:00
Lorenz Diener
c1a6772247 Bump supported version in docs, code to 2.2.0 2018-01-29 14:26:05 +01:00
Lorenz Diener
be014bb88a Fix typo that made test break 2018-01-29 14:18:23 +01:00
Lorenz Diener
569a13ee80 Add 2.1.2 functions 2018-01-29 14:14:58 +01:00
Lorenz Diener
838b851331 Fix get_supported_version() 2018-01-29 13:39:47 +01:00
codl
e97dec7306
subclass api errors 2018-01-03 11:34:45 +01:00
Lorenz Diener
08a0e5ff67 Daemonize streams 2017-12-19 15:06:44 +01:00
Lorenz Diener
9f9a7826d7 Fix streaming API to be more stable (closes #117) 2017-12-19 13:49:00 +01:00
Lorenz Diener
e5c50ea80d Fix missing async in hashtag/list streams 2017-12-19 11:04:53 +01:00
Lorenz Diener
f55ff45393 Prepare release, part 2 2017-12-15 20:26:25 +01:00
Lorenz Diener
e97bb44c86 Update changelog (preliminary) 2017-12-14 15:09:54 +01:00
Lorenz Diener
301d719b83 Fix some problems with attribute access 2017-12-14 13:54:31 +01:00
Lorenz Diener
20c1d95b45 Fix version check 2017-12-14 13:32:52 +01:00
Lorenz Diener
5a94c46bb4 Change default version check behaviour 2017-12-14 13:29:42 +01:00
Lorenz Diener
af81088fb0 Make attribute-style access better 2017-12-14 13:16:28 +01:00
Lorenz Diener
12f8a68996 Add dict attribute access 2017-12-14 12:52:33 +01:00
Lorenz Diener
16564c42b8 Fix account_statuses breakage 2017-12-14 11:17:18 +01:00
Lorenz Diener
58dfdfaec5 Add supported version in a place where python can read it 2017-12-14 00:37:19 +01:00
Lorenz Diener
e9d7a3e24a Add last-changed versioning 2017-12-14 00:27:34 +01:00
Lorenz Diener
afaab2b874 Document list endpoints 2017-12-13 22:33:29 +01:00
Lorenz Diener
0b5c0ae5cc Add remaining list endpoints 2017-12-13 22:16:10 +01:00
Lorenz Diener
b840766ed7 Add more list endpoints 2017-12-13 21:16:02 +01:00
Lorenz Diener
7cf813b974 Added account_lists(broken) 2017-12-13 18:59:32 +01:00
Lorenz Diener
c9cc873714 Add information about unauthenticated methods 2017-12-13 18:45:28 +01:00
Lorenz Diener
7d2f244126 Add internal links in docs 2017-12-13 18:40:17 +01:00
Lorenz Diener
d7d8f153a3 Update docs for search function 2017-12-13 17:55:14 +01:00
Lorenz Diener
48d54effc8 Add lists endpoint 2017-12-13 17:47:50 +01:00
Lorenz Diener
7ed769b37a Add list streaming 2017-12-13 17:26:44 +01:00
Lorenz Diener
75aebac744 Add custom_emojis 2017-12-13 17:17:42 +01:00
Lorenz Diener
c06baa13b3 Update verify_credentials docs 2017-12-13 17:11:45 +01:00
Lorenz Diener
ce5b0ca576 Update docs, fixes #106 2017-12-11 15:30:24 +01:00
Lorenz Diener
fad615b8d6 Fix versioning functionality more, explicit version check 2017-12-11 14:34:51 +01:00
Lorenz Diener
a93f051b5e Fix instance() 2017-12-11 14:22:35 +01:00
Lorenz Diener
0b701ca6ac Make the version check be not wrong 2017-12-11 14:18:54 +01:00
Lorenz Diener
3bf2299e7e Make decorated functions actually return things 2017-12-11 14:02:57 +01:00
Lorenz Diener
9acfb0d3d8 Versioning fixes 2017-12-11 14:00:14 +01:00
Lorenz Diener
d87ff6d490 Version all endpoints where such a thing makes sense 2017-12-11 12:33:30 +01:00
Lorenz Diener
3ba917d363 Add versionind decorator 2017-12-11 11:49:14 +01:00
codl
050077e97a
fix #111 2017-11-29 22:16:53 +01:00
Lorenz Diener
a7e2caa369 Check hashtags in streaming API 2017-11-29 18:04:54 +01:00
Lorenz Diener
c5970d10f9 Fix the thing I previously broke
lets pretend I was just testing the CI okay
2017-11-29 17:57:04 +01:00
Lorenz Diener
1c64c39701 add hashtag leading # detection, closes #105 2017-11-29 17:54:27 +01:00
Lorenz Diener
32adb8ce4b
Merge pull request #103 from Kjwon15/feature-asyncstream
Implement is_alive to async stream
2017-11-27 13:50:31 +01:00
codl
b9e6a1e9ba
fix string id support to also include in_reply_to_... fields 2017-11-26 22:49:32 +01:00
codl
ca11ef77ac
use six instead of relying on python version 2017-11-26 22:33:08 +01:00
kjwon15
3faf7c6473 Get current thread correctly 2017-11-25 03:09:38 +09:00
kjwon15
fa1840c0fb Implement is_alive to async stream 2017-11-25 02:52:00 +09:00
Lorenz Diener
18f69451ed Merge branch 'master' of https://github.com/halcy/Mastodon.py 2017-11-24 15:26:42 +01:00
Lorenz Diener
9e97fce2d6 Break streaming entirely, update docs 2017-11-24 15:25:38 +01:00
Lorenz Diener
e220e7cc60 Many fixes for streaming stuff 2017-11-24 15:08:34 +01:00
Lorenz Diener
cea4d4251a Change exceptions slightly 2017-11-24 14:20:27 +01:00
Lorenz Diener
de2114b92b BREAKING: Make streaming use json hooks 2017-11-24 13:59:50 +01:00
Lorenz Diener
92adc94a77
Merge pull request #102 from codl/http-streams
fix #101 by checking if the stream api uses ws:// or wss://
2017-11-22 14:29:24 +01:00
codl
c3a31930b8
fix #101 by checking if the stream api uses ws:// or wss:// 2017-11-22 14:14:35 +01:00
Lorenz Diener
8987590545 ID Unpacking 2017-11-22 10:26:44 +01:00
Lorenz Diener
7771b27b72 Document local hashtag timelines 2017-11-21 14:47:13 +01:00
Lorenz Diener
32f8b8bed9 Added support for local hashtag timelines 2017-11-21 14:46:43 +01:00
Lorenz Diener
e1a1592575 Documented report dicts 2017-11-21 14:33:04 +01:00
Lorenz Diener
e31b9441f8 Documentation about visibility fixed (Fixes #55) 2017-11-21 13:59:50 +01:00
Lorenz Diener
39548ffe98 Merge branch 'master' of https://github.com/halcy/Mastodon.py 2017-11-21 13:57:21 +01:00
Lorenz Diener
56ec90f17c
Merge pull request #99 from foozmeat/master
Adds alt text support for media uploads
2017-11-21 13:57:03 +01:00
Lorenz Diener
d303afefc8 Manually merge #94 2017-11-21 13:53:42 +01:00
James Moore
23d57587e4
Added optional media description
This works with the new alt text support in mastodon 2.0.
2017-11-09 11:55:13 -08:00
codl
6b5deb4898
add support for mastodon v2.0's string IDs 2017-11-05 14:17:49 +01:00
Lorenz Diener
61552f9f84 Merge pull request #93 from codl/fix-ratelimit
fix #92, check for throttling by status code, and do it before the catchall error handler
2017-10-16 11:19:49 +02:00
Haisenburg
9a7efa3657 Use urlparse instead of urllib.parse for python2.7 2017-10-08 03:50:19 +08:00
codl
0ff6abf2f4
fix #92, check for throttling by status code, and do it before the catchall error handler 2017-10-04 16:08:21 +02:00
Lorenz Diener
b18b6f201b Merge pull request #89 from Elizafox/exception-hierarchy
Redesign exception hierarchy
2017-10-02 10:13:23 +02:00
Elizabeth Myers
c64617ee94 Redesign exception hierarchy
All Mastodon.py errors now derive from MastodonError, for easier
catching in application code that just wants to see if something
happened, and isn't too miffed about the details.

I/O Errors derive from MastodonIOError, for similar reasons.

This change is designed to be backwards compatible.
2017-09-25 19:11:16 -05:00
Elizabeth Myers
9ec0655365 Properly fix redirecting streaming endpoints.
Fixes #84
2017-09-25 18:01:41 -05:00
Elizabeth Myers
67018b2249 Fix notifications_dismiss by passing parameter correctly 2017-09-18 09:59:35 -05:00
Elizabeth Myers
5b90a3c830 Remove debugging print statements 2017-09-16 10:09:32 -05:00
Elizabeth Myers
6067aa4604 Workaround Mastodon issue with streaming API redirection
Mastodon can be configured to use another address for streaming
server-side. Such a setup is common with certain deployments.

However, due to a bug, Mastodon does not properly issue HTTP redirects
for anything but the endpoint /api/v1/streaming (including subdirs). It
instead gives a 404, causing the request to fail.

The workaround is to hit this path first, checking for any redirects,
and modifying the URL accordingly.

This commit also includes a workaround for behaviour in requests that
causes it to strip the Authorization header from redirected requests.
This is intentional behaviour on the part of requests, but breaks the
redirection done by Mastodon.

Fixes #84
2017-09-16 10:05:44 -05:00
codl
92dd24450d
fix exception in log_in, by accepting json dates as timestamps
when requesting a bearer token, mastodon (more specifically doorkeeper)
returns an object with a created_at attribute which is a plain timestamp
unlike in most of mastodon's api:

{
    "access_token": "hunter2",
    "token_type": "bearer",
    "scope": "read write",
    "created_at": 1504824250,
}
2017-09-10 12:23:54 +02:00
Lorenz Diener
7ded08fd84 Fix for fix 2017-09-08 16:41:39 +02:00