Skip to main content

A plurk-bot pack with plurk-api wrapper written in Python.

Project description

PyPlurky

The best surface between Plurk Oauth and python.

This is a project that try to connect plurk_oauth and python better. Make it easier to use for python developer.

For more API information, please visit:

Why you need it

This project is to make "bot develop" easier. For some reasons, we need a plurk bot, but everything is not prepared. That is why we need it: A good dispatcher, handler, and easier function to call API. A good error manager for developing more efficiency. If you only want to develop plurk reader, it is also fine to ignore function like dispatcher.

Installation

pip install pyplurky

Or get the latest version.

git clone https://github.com/Dephilia/PyPlurky.git

Usage

Please check your API.keys file first. Key in your consumer key from Plurk API page, if you already have access token, it's ok to key in.

First import module.

from pyplurky import pyplurky

There are three mode can be used in pyplurky.

pk=pyplurky(mode="BOT",key="API.keys")
# Bot mode

pk=pyplurky(mode="READING",key="API.keys")
# This will listen to your timeline but do nothing.

pk=pyplurky(mode="REPL",key="API.keys")
# Enter to REPL environment

The pyplurky parameter mode must be BOT or REPL or READER. Under REPL mode, you can test some code like:

p.users.me()

p is the abbreviation of plurk object.

More example is like the under code:

from pyplurky import pyplurky,api

pk=pyplurky(mode="BOT",key="API.keys")

def hey():
    print("hey")

def addAllFriend(plurk):
    plurk.alerts.addAllAsFriends()

def sayHi(plurk,data):
    id=data.plurk_id
    plurk.responses.responseAdd(id,"Hi")


pk.job.every(5).minutes.do(hey)
pk.JobStart()

pk.addRepeatHandler(addAllFriend)

pk.addResponseHandler("Hi",sayHi)

pk.addPlurkHandler("Hi",sayHi)

if __name__=="__main__":
    pk.main()

addResponseHandler: Add key word that will post when a new plurk shows.

addPlurkHandler: Add key word that will post when a new response shows.

The job object use python schedule module, for more usage, please check it.

requirement

  • plurk-ouath
  • schedule

Bugs in Plurk

Here shows some plurk bugs, not cause by module.

  1. cliques.add/remove will always return true
  2. No cliques delete
  3. block.block/unblock will always return true
  4. Comet Server instability

Future Work

  1. Complete All API at test console (not write on document)
  2. Function Handler (Plurk/Response/Continue) (Done)
  3. Routine Work
  4. Event Setter
  5. Use both getPlurk API and comet to prevent comet server problem.
  6. Async handler

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyplurky-0.3.2.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyplurky-0.3.2-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file pyplurky-0.3.2.tar.gz.

File metadata

  • Download URL: pyplurky-0.3.2.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for pyplurky-0.3.2.tar.gz
Algorithm Hash digest
SHA256 aad99c1a2176319ae4c79435d6dd879910270f15c4159bf3891189b648ad7088
MD5 f5159ebd1895cfcf3b88624cea5873d0
BLAKE2b-256 15e2f8a679d7d54502c58225b3a42cb1de91976e4b2e88f16da7cb0f5973d355

See more details on using hashes here.

File details

Details for the file pyplurky-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: pyplurky-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for pyplurky-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e6d9bd923bd407e4b6e602fb6e11cc7b78d25e1197c722f3557558e3b80b91ff
MD5 a68b4f818437b9197015b7e6eb906011
BLAKE2b-256 b828f62cf27a756c6696a0135d1488dd48a53a85db8081cb4aa3a7cd104e359d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page