1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XenForo API in Python

Discussion in 'Off Topic' started by SectionEighty, Aug 23, 2016.

  1. SectionEighty

    SectionEighty Member

    Hi all,

    there's now a XF API in Python: https://git.io/v69cB -- thought someone here might find it useful.
    NixFifty and Ark Royal like this.
  2. ManagerJosh

    ManagerJosh Well-Known Member

    I know I'm not a programmer/developer and I don't pretend to be one, but reading the code - it looks like it leverages the XF user permissions... which is awesome...except for the fact everyone is going to be assigning it by default an XF admin account.
  3. Digital Doctor

    Digital Doctor Well-Known Member

    Cool :)


    PyXenForoAPI is module that'll help you interact with websites running the famous XenForo forum.


    Post in a thread
    Edit a post
    Delete a post
    Create a thread in a specific section
    Edit a thread
    Start a new conversation
    Reply to a conversation
    Get all messages from a conversation

    From PyPi:

    $ pip install pyxenforoapi

    $ easy_install pyxenforoapi
    Or clone from Github:

    $ git clone https://github.com/lqaz/pyxenforoapi

    $ cd pyxenforoapi

    $ sudo python3 setup.py install


    from pyxenforoapi import pyxenforo

    xf = pyxenforo.Xenforo(username, password, site)
    If you want to use a proxy to login, pass the proxy parameter, the proxy must be passed as a dict. Example:

    xf = pyxenforo.Xenforo(username, password, site, proxy={"http:" "http://user:pass@host:port/", "https": "https://user:pass@host:port/"})

    username (str): The username you login with

    password (str): Password to your account

    site (str): Website to login to

    Keyword args:

    proxy (dict): Optional to pass, specify proxy as a dictionary if you wish to use a proxy. The proxy will be used on all your actions, only need to specify it once


    LoginError if the login was unsuccessful

    Post in a thread:

    xf.post_in(thread, reply)

    thread (str): thread id to post in

    reply (str): message to reply with

    Edit a post:

    xf.edit_post(post_id, text)

    post_id (str): id of the post to edit

    text (str): text to replace the current post with

    Delete a post:

    xf.delete_post(post_id, delete_value, reason)

    post_id (str): the ID of the post you want to delete.

    delete_value (int): whether to soft (0) or hard delete a post (1)

    reason (str): reason for removal of the post, empty string equals no reason.

    Create a thread:

    xf.create_thread_in(section, title, body)

    section (str): which section to post the thread in

    title (str): what to title the thread

    body (str): the message of the thread

    Edit a thread:

    xf.edit_thread(thread, new_title)

    thread (str): id of the thread you wish to edit

    new_title (str): what to replace the current title with

    Start a new conversation:

    xf.new_conversation(recipient, title, message)

    recipients (str): The names of users you want to start a conversation with. Separate names with comma

    title (str): The title of the conversation

    message (str): The message you want to start the conversation with

    Reply to a conversation:

    xf.reply_to_conversation(conversation_id, message)

    message (str): The message to reply with

    conversation_id (str): The conversation to add a reply to

    Get conversation messages:


    conversation_id (str): The conversation to get messages from


    PyXenForoAPI is protected by the MIT license.
  4. Kintaro

    Kintaro Well-Known Member

    are you using it?
    why is not published on RM here too?
  5. Kintaro

    Kintaro Well-Known Member

    on GITHub is not available anymore :(

Share This Page