Merge pull request #143 from MarkEEaton/master
Revise sample code in README.rst
This commit is contained in:
commit
e1e003ec76
S'han modificat 2 arxius amb 29 adicions i 11 eliminacions
19
README.rst
19
README.rst
|
@ -1,10 +1,11 @@
|
|||
Mastodon.py
|
||||
===========
|
||||
Register your app! This only needs to be done once. Uncomment the code and substitute in your information.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from mastodon import Mastodon
|
||||
|
||||
# Register app - only once!
|
||||
'''
|
||||
Mastodon.create_app(
|
||||
'pytooterapp',
|
||||
|
@ -13,8 +14,12 @@ Mastodon.py
|
|||
)
|
||||
'''
|
||||
|
||||
# Log in - either every time, or use persisted
|
||||
'''
|
||||
Then login. This can be done every time, or use persisted.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from mastodon import Mastodon
|
||||
|
||||
mastodon = Mastodon(
|
||||
client_id = 'pytooter_clientcred.secret',
|
||||
api_base_url = 'https://mastodon.social'
|
||||
|
@ -24,9 +29,13 @@ Mastodon.py
|
|||
'incrediblygoodpassword',
|
||||
to_file = 'pytooter_usercred.secret'
|
||||
)
|
||||
'''
|
||||
|
||||
# Create actual API instance
|
||||
To post, create an actual API instance.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from mastodon import Mastodon
|
||||
|
||||
mastodon = Mastodon(
|
||||
access_token = 'pytooter_usercred.secret',
|
||||
api_base_url = 'https://mastodon.social'
|
||||
|
|
|
@ -2,12 +2,13 @@ Mastodon.py
|
|||
===========
|
||||
.. py:module:: mastodon
|
||||
.. py:class: Mastodon
|
||||
|
||||
Register your app! This only needs to be done once. Uncomment the code and substitute in your information.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from mastodon import Mastodon
|
||||
|
||||
# Register app - only once!
|
||||
'''
|
||||
Mastodon.create_app(
|
||||
'pytooterapp',
|
||||
|
@ -16,8 +17,12 @@ Mastodon.py
|
|||
)
|
||||
'''
|
||||
|
||||
# Log in - either every time, or use persisted
|
||||
'''
|
||||
Then login. This can be done every time, or use persisted.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from mastodon import Mastodon
|
||||
|
||||
mastodon = Mastodon(
|
||||
client_id = 'pytooter_clientcred.secret',
|
||||
api_base_url = 'https://mastodon.social'
|
||||
|
@ -27,14 +32,18 @@ Mastodon.py
|
|||
'incrediblygoodpassword',
|
||||
to_file = 'pytooter_usercred.secret'
|
||||
)
|
||||
'''
|
||||
|
||||
# Create actual API instance
|
||||
To post, create an actual API instance.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from mastodon import Mastodon
|
||||
|
||||
mastodon = Mastodon(
|
||||
access_token = 'pytooter_usercred.secret',
|
||||
api_base_url = 'https://mastodon.social'
|
||||
)
|
||||
mastodon.toot('Tooting from python using #mastodonpy !')
|
||||
mastodon.toot('Tooting from python using #mastodonpy !')
|
||||
|
||||
`Mastodon`_ is an ActivityPub and OStatus based twitter-like federated social
|
||||
network node. It has an API that allows you to interact with its
|
||||
|
|
Loading…
Referencia en una nova incidència