Interact with pokernow.club via a simple Python API
Project description
py-pokernow
A Python library for primarily interacting with pokernow.club's club API.
Features
- Club Management: Create and manage poker clubs (chips, games, etc)
- 🔐 Authentication: Easy login through api
🎮 Play API: Maybe one day
Contributing
If someone could actually implement the api/websocket for playing, you would be the goat.
Installation
pip install py-pokernow
Quick Start
from pokernow import PokerNowSession
# Initialize session with your authentication token
session = PokerNowSession(apt_token="your_apt_token_here")
# Get club information
club = session.get_club("your-club-slug")
print(f"Club: {club.name}")
print(f"Players: {len(club.players)}")
print(f"Total chips: {club.total_chips_in_club()}")
# Add chips to a player using the club object
player = club.get_player_by_username("player_name")
if player:
club.add_chips_to_player(
user_id=player.id,
amount=1000,
reason="Bonus chips"
)
# Create a new game using the club object
from pokernow import PokerGameConfig
config = PokerGameConfig(
name="High Stakes",
small_blind=50,
big_blind=100,
maxQuantityPlayers='9',
gameType='th' # Texas Hold'em
)
game_id = club.create_game(config)
print(f"Created game: {game_id}")
Core Classes
PokerNowSession
Main session class for API interactions.
session = PokerNowSession(apt_token="your_token")
PokerNowClub
Represents a poker club with all its data.
club = session.get_club("club-slug")
print(club.name)
print(club.description)
print(club.players) # List of PokerNowPlayer objects
print(club.games) # List of PokerNowGame objects
PokerNowPlayer
Represents a player in the club.
player = club.get_player_by_username("username")
print(player.chips_balance)
print(player.club_role)
print(player.credit_limit)
PokerNowGame
Represents a game/table.
game = club.games[0]
print(game.custom_table_name)
print(game.small_blind, game.big_blind)
print(game.status)
PokerNowTransaction
Represents a wallet transaction.
transactions = club.get_player_transactions(player.id)
for tx in transactions:
print(f"{tx.reason}: {tx.quantity} chips")
API Methods
PokerNowSession Methods
Club Management:
get_club(slug)- Get club information (returns club with session attached)create_club(slug, name, description, use_cents)- Create a new club
User Profile:
update_user(username, email)- Update current user's profile
Payment & Subscription:
create_stripe_checkout(mode, plan, receiver_user_id)- Create checkout sessionhandle_payment_callback(session_id)- Handle payment callback
PokerNowClub Methods
Once you have a club object (via session.get_club()), you can call these methods directly on it:
Settings:
club.set_ledger_visibility(show)- Toggle ledger visibilityclub.set_play_report_visibility(show)- Toggle play report visibilityclub.set_game_archive_visibility(show)- Toggle archive visibilityclub.set_p2p_transfers(enabled)- Enable/disable P2P transfersclub.set_exclusivity(option, message)- Set club exclusivity settingsclub.set_landing_page(content)- Set club landing page (Markdown)club.set_rules(content)- Set club rules (Markdown)
Player Management:
club.add_chips_to_player(user_id, amount, reason)- Add chipsclub.remove_chips_from_player(user_id, amount, reason)- Remove chipsclub.send_chips_to_player(receiver_user_id, amount)- Send chips to another player (P2P)club.set_credit_limit_for_player(user_id, amount)- Set credit limitclub.get_player_transactions(user_id)- Get transaction historyclub.set_player_role(player_user_id, role)- Set player role
Game Management:
club.create_game(config)- Create a new gameclub.create_preset(config)- Create a game presetclub.close_game(game_id)- Close a game
Game Configuration
Create custom game configurations using PokerGameConfig:
config = PokerGameConfig(
name="My Game",
small_blind=10,
big_blind=20,
# Optional parameters
maxQuantityPlayers='6',
gameType='plo', # Pot Limit Omaha
decisionTime='30',
timebank='15',
straddle='true',
runItTwice='ask_players'
)
Game Types
'th'- Texas Hold'em'omaha'- Omaha Hi'plo8'- Omaha Hi/low
Authentication
Get your apt_token by logging into pokernow.club and inspecting your cookies (view QUICKSTART.md for step by step instructions).
For programmatic login (requires OTP):
from pokernow import login
def otp_callback(email):
return input(f"Enter OTP sent to {email}: ")
session = login("your@email.com", otp_callback)
Requirements
- Python 3.7+
- beautifulsoup4 >= 4.9.0
- requests >= 2.25.0
Development
# Clone the repository
git clone https://github.com/yourusername/py-pokernow.git
cd py-pokernow
# Install development dependencies
pip install -e ".[dev]"
Disclaimer
This is an unofficial library and is not affiliated with or endorsed by pokernow.club. Use at your own risk and ensure compliance with pokernow.club's terms of service.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_pokernow-0.2.0.tar.gz.
File metadata
- Download URL: py_pokernow-0.2.0.tar.gz
- Upload date:
- Size: 26.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bdd0d50c5e4a8f01601e97eab3a2351e4d0704536daee2168ffe6aed3d2ab4c
|
|
| MD5 |
74d6b137cd51374b14f694956bbd70ac
|
|
| BLAKE2b-256 |
3edf4269c0f5a533967957f7f081ace34c2cd7ae0f8bd8570add3d9e77d06bed
|
File details
Details for the file py_pokernow-0.2.0-py3-none-any.whl.
File metadata
- Download URL: py_pokernow-0.2.0-py3-none-any.whl
- Upload date:
- Size: 24.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50bb955a8e590b1557f98c0373540cd38f5d47e6eba4d5260f518e5015a35d4b
|
|
| MD5 |
080257127155ab631afd9493e431f54d
|
|
| BLAKE2b-256 |
c213e1b85da0cd8f51cebd0f1b53d7f2ff51408fe679d92426a0bf49deb6056e
|