项目作者: Sreyas-Sreelal

项目描述 :
Unofficial SA-MP forum api
高级语言: Python
项目地址: git://github.com/Sreyas-Sreelal/forum-py.git
创建时间: 2018-05-25T08:49:29Z
项目社区:https://github.com/Sreyas-Sreelal/forum-py

开源协议:GNU General Public License v3.0

下载


forum-py

GitHub issues GitHub pull requests GitHub pull license GitHub pull license GitHub pull license

forumpy is an unofficial SA-MP forum api.This python library ,integerated with selenium and phantomJS,helps you to automate SA-MP forum acitivities like send and get pms,threads,userinfo,contacts etc.Please view the example files for information about using these features in your python application.forumpy is still under development and has not yet been released.

Installing

Use pip to install latest version of forumpy

  1. pip install forumpy

Quick examples

  • Basic

    1. from forum.account import Account
    2. name = input("Input your forum user name : ")
    3. password = input("Input your forum password : ")
    4. a = Account(name,password)
    5. print("Logined with user id : ",a.id)
    6. print("\t**Account info**\n",a.User.info())
    7. print("\n\t***Contacts***\n")
    8. print("\tId\tUsername")
    9. for i in a.getcontacts():
    10. print("\t",i.id,"\t",i.name)
    11. print("\n\t***Threads***\n")
    12. print("\tTitle\tRatings\tAuthor")
    13. for i in a.User.getthreads():
    14. print(i.title,"\t",i.getrating(),"\t",i.author.name)
  • Send and Get private messages

    1. from forum.user import User
    2. from forum.account import Account
    3. name = input("Input forum username : ")
    4. password = input("Input forum password : ")
    5. a = Account(name,password)
    6. print(a.getpms())
    7. rec_names = input("Input name of recipents (seperated by space) : ").split(" ")
    8. users = []
    9. for rec_name in rec_names:
    10. users.append(User(a,a.getIdFromUserName(rec_name)))
    11. title = input("Input title : ")
    12. content = input("Input content : ")
    13. a.send_pm(users,title,content)

Please view examples files for more examples

Requirements

  • Python 3.5+
  • Selenium library
  • PhantomJS headless web driver
  • BeautifulSoup library