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(
        player_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_player_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

Player Management:

  • club.add_chips_to_player(player_id, amount, reason) - Add chips
  • club.remove_chips_from_player(player_id, amount, reason) - Remove chips
  • club.set_credit_limit_for_player(player_id, amount) - Set credit limit
  • club.get_player_transactions(player_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
  • 'plo' - Pot Limit Omaha
  • 'plo5' - 5-Card PLO
  • 'ofc' - Open Face Chinese

Authentication

Get your apt_token by logging into pokernow.club and inspecting your cookies.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_pokernow-0.1.0.tar.gz
  • Upload date:
  • Size: 25.1 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.1.0.tar.gz
Algorithm Hash digest
SHA256 50dc617808076c3ea2fe2287b3aae067bbbdfcb3c91ee3fa0b2827ed6fe0138b
MD5 8da22fee9229cf5b39f7174289e110d8
BLAKE2b-256 efbea557d0e49bec236cd2a7d284f2852ab6a8f3f0d2be09507df230da18a601

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_pokernow-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.6 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4658309ed5f14b5cf312bb37cbdc39086ca7992a1c226426428d093fa18817f3
MD5 80c2405b21bb47129a13171c2ba3c00b
BLAKE2b-256 6c0e5320745ac4913594173671b6b8fb5a984811c52bcd15cd4327e4ede99e6d

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