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.5.tar.gz (26.8 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.5-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_pokernow-0.2.5.tar.gz
  • Upload date:
  • Size: 26.8 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.5.tar.gz
Algorithm Hash digest
SHA256 0f8d1ae975a79a34a78008f81c2fe69707c039ca6fde16861a3c03e7f9acd849
MD5 46ae661dcf19e4bb363dd8c2eb5b5898
BLAKE2b-256 bafae552a2ec2327fadba0b7eca65c75309a937806620b2650c982bb47ec4eea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_pokernow-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 25.1 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cd2703d3793b4f53ebe1f372e342376d15ead11677c6ebc6896883e61efc012e
MD5 89387eb60e5036bcae9b458b9a1222f7
BLAKE2b-256 2766ec1e4c3b93221b220ef907a3085419a668bb1114cf0b6107d6f6a2fceefd

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