Skip to main content

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 session
  • handle_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 visibility
  • club.set_play_report_visibility(show) - Toggle play report visibility
  • club.set_game_archive_visibility(show) - Toggle archive visibility
  • club.set_p2p_transfers(enabled) - Enable/disable P2P transfers
  • club.set_exclusivity(option, message) - Set club exclusivity settings
  • club.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 chips
  • club.remove_chips_from_player(user_id, amount, reason) - Remove chips
  • club.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 limit
  • club.get_player_transactions(user_id) - Get transaction history
  • club.set_player_role(player_user_id, role) - Set player role

Game Management:

  • club.create_game(config) - Create a new game
  • club.create_preset(config) - Create a game preset
  • club.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

py_pokernow-0.2.4.tar.gz (26.7 kB view details)

Uploaded Source

Built Distribution

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

py_pokernow-0.2.4-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file py_pokernow-0.2.4.tar.gz.

File metadata

  • Download URL: py_pokernow-0.2.4.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for py_pokernow-0.2.4.tar.gz
Algorithm Hash digest
SHA256 a590d11171dd1246809a1b473af75092a0f585254d959fd1b157416436531868
MD5 940ff7cb4a1ba369111337ef4e3f4f32
BLAKE2b-256 07bb8d9c57285924ea23413689f6c17815a76c69281aa7f6812c86ca10c09b43

See more details on using hashes here.

File details

Details for the file py_pokernow-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: py_pokernow-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 25.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for py_pokernow-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 38b5008656fd22eb5a54b6b5998ab82e42078b17652eb21274ca6385ee2c1366
MD5 66546265fb0af8dbaefe44cbfed8a757
BLAKE2b-256 90b27514f439b8fcbb0969d0948a2df6f49fd7af01af512a7045b55dedd360c9

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