Go to file
Github Mirror d7c113e495 initial import
Import from web-archive of https://bitbucket.org/tobiasd/python-friendica
Licence from project page: https://www.openhub.net/p/python-friendica
2022-12-03 19:03:54 +01:00
LICENSE Initial commit 2022-12-03 19:02:23 +01:00
README.md initial import 2022-12-03 19:03:54 +01:00
friendica.py initial import 2022-12-03 19:03:54 +01:00
test_poco.py initial import 2022-12-03 19:03:54 +01:00

README.md

friendica.py

A python3 module to access the friendica API, as documented in the friendica wiki at github. Additionally this module includes basic functions to handle the POCO information of a Friendica profile. You cal also use it to fetch information about the new stuff friendica usially notifies you about (the PING functionality).

Author: Tobias Diekershoff

Repository

The repository for this module, alongside with a bugtracker and a wiki is located at Bitbucket.

License

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Tobias Diekershoff BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Usage

Here is a basic example of the usage of the module.

import friendica
# make a new instance of friendica
f = friendica.friendica (server = 'your-friendica-node.tld',
                         username = 'your-nick',
                         password = 'some secret password')
# check that we are logged in
f.account_verify_credentials()

# get the current notifications
print (f.ping())

# post something with the default settings
f.statuses_update( status = "here is the message you are going to post" )

Additional to the official API

As addition to the official friendica API/POCO functionality, this module has some wrapper functions to API calls.

friendica.post: is a wrapper for the statuses/update function taking the same optional parameters, but stauts is called message because I like message more then status.

friendica.new_event: also a wrapper for statuses/update but tailored to post a new event entry to friendica. Mandatory arguments are event_summary and event_start. See the inline docs for more details.

ToDo

  • Test that the proxy configuration is honoured
  • Support the different connectors when posting a new entry over the API. Currently the post_to_connector parameter of the API call is simply ignores.
  • If a protocol is specified in the server name parameter of the friendica constructor, use it