Added 'remote' param to GET /api/v1/timelines/public (Mastodon v3.1.4)

This commit is contained in:
spla 2022-08-27 12:36:01 +02:00
pare f49203f9a4
commit e33166f025
S'han modificat 3 arxius amb 33 adicions i 48 eliminacions

Veure arxiu

@ -1,21 +1,18 @@
Mastodon.py Mastodonplus.py
=========== ===========
Python wrapper for the Mastodon ( https://github.com/tootsuite/mastodon/ ) API. Fork of Python wrapper for the Mastodon ( https://github.com/tootsuite/mastodon/ ) API.
Feature complete for public API as of Mastodon version 3.0.1 and easy to get started with:
.. code-block:: python This fork's goal is to add new Mastodon API's endpoints to the excellent halcy's wrapper.
# Register your app! This only needs to be done once. Uncomment the code and substitute in your information. # Register your app! This only needs to be done once. Uncomment the code and substitute in your information.
from mastodon import Mastodon from mastodon import Mastodon
'''
Mastodon.create_app( Mastodon.create_app(
'pytooterapp', 'pytooterapp',
api_base_url = 'https://mastodon.social', api_base_url = 'https://your-mastodon.server',
to_file = 'pytooter_clientcred.secret' to_file = 'pytooter_clientcred.secret'
) )
'''
# Then login. This can be done every time, or use persisted. # Then login. This can be done every time, or use persisted.
@ -23,7 +20,7 @@ Feature complete for public API as of Mastodon version 3.0.1 and easy to get sta
mastodon = Mastodon( mastodon = Mastodon(
client_id = 'pytooter_clientcred.secret', client_id = 'pytooter_clientcred.secret',
api_base_url = 'https://mastodon.social' api_base_url = 'https://your-mastodon.server'
) )
mastodon.log_in( mastodon.log_in(
'my_login_email@example.com', 'my_login_email@example.com',
@ -37,40 +34,17 @@ Feature complete for public API as of Mastodon version 3.0.1 and easy to get sta
mastodon = Mastodon( mastodon = Mastodon(
access_token = 'pytooter_usercred.secret', access_token = 'pytooter_usercred.secret',
api_base_url = 'https://mastodon.social' api_base_url = 'https://your-mastodon.server'
) )
mastodon.toot('Tooting from python using #mastodonpy !') mastodon.toot('Tooting from python using #mastodonpy !')
You can install Mastodon.py via pypi: You can install Mastodonplus.py via pypi:
.. code-block:: Bash
# Python 3 # Python 3
pip3 install Mastodon.py pip3 install Mastodonplus.py
Note that python 2.7 is now no longer officially supported. It will still # New features
work for a while, and we will fix issues as they come up, but we will not
be testing specifically for python 2.7 any longer.
Full documentation and basic usage examples can be found * 26.8.2022. Added New endpoints: /api/v1/admin/domain_blocks (list, show by id, delete and create)
at http://mastodonpy.readthedocs.io/en/stable/ . * 27.8.2022. Mastodon v3.1.4. Added 'remote" param to GET /api/v1/timelines/public REST API.
Maintenance
-----------
As you might have noticed, I have not done any maint work on this project in a while.
I am currently extremely busy with my actual paid work, and will not be able to work
on Mastodon.py until I hand in my dissertation, i.e. there will be no new releases or
code from me for at least the rest of this year, maybe part of next. If you would like
to temporarily take over bug fixing / test writing / new method implementing, hit me up.
Acknowledgements
----------------
Mastodon.py contains work by a large amount of contributors, many of which have
put significant work into making it a better library. You can find some information
about who helped with which particular feature or fix in the changelog.
.. image:: https://travis-ci.org/halcy/Mastodon.py.svg?branch=master
:target: https://travis-ci.org/halcy/Mastodon.py
.. image:: https://codecov.io/gh/halcy/Mastodon.py/branch/master/graph/badge.svg
:target: https://codecov.io/gh/halcy/Mastodon.py

Veure arxiu

@ -788,7 +788,7 @@ class Mastodon:
since_id=since_id, limit=limit) since_id=since_id, limit=limit)
@api_version("1.0.0", "2.6.0", __DICT_VERSION_STATUS) @api_version("1.0.0", "2.6.0", __DICT_VERSION_STATUS)
def timeline_public(self, max_id=None, min_id=None, since_id=None, limit=None, only_media=False): def timeline_public(self, max_id=None, min_id=None, since_id=None, limit=None, only_media=False, remote=None):
""" """
Fetches the public / visible-network timeline, not including replies. Fetches the public / visible-network timeline, not including replies.
@ -810,6 +810,9 @@ class Mastodon:
if only_media == False: if only_media == False:
del params_initial['only_media'] del params_initial['only_media']
if remote != None:
params_initial['remote'] = remote
url = '/api/v1/timelines/public' url = '/api/v1/timelines/public'
params = self.__generate_params(params_initial) params = self.__generate_params(params_initial)

Veure arxiu

@ -1,4 +1,6 @@
from setuptools import setup import setuptools
VERSION = '1.5.5.1'
test_deps = [ test_deps = [
'pytest', 'pytest',
@ -25,10 +27,16 @@ extras = {
"blurhash": blurhash_deps, "blurhash": blurhash_deps,
} }
setup(name='Mastodon.py', with open('README.rst', 'r', encoding='utf-8') as fh:
version='1.5.1', long_description = fh.read()
description='Python wrapper for the Mastodon API',
setuptools.setup(
name='Mastodonplus.py',
version=VERSION,
description='Python wrapper for the Mastodon API (new endpoints)',
packages=['mastodon'], packages=['mastodon'],
long_description=long_description,
long_description_content_type='text/markdown',
install_requires=[ install_requires=[
'requests>=2.4.2', 'requests>=2.4.2',
'python-dateutil', 'python-dateutil',
@ -39,7 +47,7 @@ setup(name='Mastodon.py',
] + blurhash_deps, ] + blurhash_deps,
tests_require=test_deps, tests_require=test_deps,
extras_require=extras, extras_require=extras,
url='https://github.com/halcy/Mastodon.py', url='https://git.mastodont.cat/spla/Mastodon.py',
author='Lorenz Diener', author='Lorenz Diener',
author_email='lorenzd+mastodonpypypi@gmail.com', author_email='lorenzd+mastodonpypypi@gmail.com',
license='MIT', license='MIT',