Skip to content

Commit

Permalink
Merge pull request #2 from ukwhatn/develop
Browse files Browse the repository at this point in the history
Release 3.0.0a11
  • Loading branch information
ukwhatn authored Mar 16, 2024
2 parents c259b05 + 67fae7a commit 3b416c2
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ build:

release:
python -m twine upload dist/*
rm -rf dist

PHONY: build release
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,64 @@
# wikidot.py - A Python library for making requests to the Wikidot sites.

## Installation
```bash
pip install wikidot
```

## Usage
> [!NOTE]
> You can use this library without logging in, but you can only use the features that do not require logging in.
```python
import wikidot

# Create a new Client class and logging in with the credentials of your wikidot account
# If you don't want to log in : with wikidot.Client() as client:
with wikidot.Client(username='input-your-name', password='input-your-password') as client:
# ------
# user features
# ------
# Get the user object of the user
user = client.user.get('input-a-username')
# Bulk execution by asynchronous request
users = client.user.get_bulk(['input-a-username', 'input-another-username'])

# ------
# site features
# ------
# Get the site object of the SCP Foundation
site = client.site.get('scp-wiki')

# invite a user to the site
site.invite_user(user)

# Get all unprocessed applications for the site
applications = site.get_applications()

# process an application
for application in applications:
application.accept()
# or
application.reject()

# ------
# private message features
# ------
# Get messages in your inbox
received_messages = client.private_message.get_inbox()

# Get messages in your sent box
sent_messages = client.private_message.get_sentbox()

# Get message by id
# NOTE: You can only get the message that you have received or sent
message = client.private_message.get(123456)
# Bulk execution by asynchronous request
messages = client.private_message.get_messages([123456, 123457])

# Send a message to a user
client.private_message.send(
recipient=user,
subject='Hello',
body='Hello, world!'
)
```
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "wikidot"
version = "3.0.0a1"
version = "3.0.0a11"
authors = [{ name = "ukwhatn", email = "[email protected]" }]
description = "Wikidot Utility Library"
readme = "README.md"
Expand Down
1 change: 1 addition & 0 deletions wikidot/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .module.client import Client

0 comments on commit 3b416c2

Please sign in to comment.