Skip to main content

A tool to get certain data from DraftKings

Project description

About this project

This tool was created to help manage a DraftKings league as the commissioner. It used to be a script that was used to generate a blog post template for Platanofb.com, a GitHub Pages project. Now, this tool is a group of functions that can be called to return data, which makes integration with other projects, like a Flask website, possible.

One of the new features is login_to_dk() which logs in to DraftKings and stores/loads cookies; this enables getting contest details automatically, an improvement over downloading the contest results CSV and supplying the file to the old script. A wiki will be updated to describe usage of each function, although they are appropriately named and comments are included inline with the code.

Usage

Create a session to be passed to the functions of dkextract

import dkextract, requests

s = requests.session()
dkextract.get_all_players(session=s, week=1, year=2020)

DraftKings credentials and other values

This tool will look for DraftKings credentials in the following environment variables:

export DKUSER=dkuser@email.com
export DKPASS=dkp@ssw0rd

Some other values that are not obvious when using the tool:

all_members = set(["dk_username1", "dk_username2", "dk_username3"])
winning_values = {1: 100, 2: 50, 3: 25}
week1 = 'Sep 9, 2021 20:20:00'
  • all_members is a set of all DraftKings member names
  • winning_values is a value assigned to a rank. In this example, first place (rank 1 or 1:) is assigned a value of 100. Pass this to generate_results()
  • week1 is the date and time of the first game of the season.

Thank you

Thanks for taking a look at my tool. Please feel free to provide feedback or suggestions, but notice, this code was created and written for fun.

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

dkextract-1.49.tar.gz (44.8 kB view details)

Uploaded Source

Built Distribution

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

dkextract-1.49-py3-none-any.whl (32.1 kB view details)

Uploaded Python 3

File details

Details for the file dkextract-1.49.tar.gz.

File metadata

  • Download URL: dkextract-1.49.tar.gz
  • Upload date:
  • Size: 44.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for dkextract-1.49.tar.gz
Algorithm Hash digest
SHA256 cbe6179392eff69b7c275dfb91d199244555cf48ec59c78ffcb74071c36b19f3
MD5 b55d7e4e7940e3e4faef2e1bdc5e5965
BLAKE2b-256 8ba0924366976b8451764573b962c99556ae3575b73e6bd6529d5dfa38027cbf

See more details on using hashes here.

File details

Details for the file dkextract-1.49-py3-none-any.whl.

File metadata

  • Download URL: dkextract-1.49-py3-none-any.whl
  • Upload date:
  • Size: 32.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for dkextract-1.49-py3-none-any.whl
Algorithm Hash digest
SHA256 e9a0a790fdeece57c440c24376ec4e36c39434033d489506ef0a167e7cddf8d2
MD5 04c8b7a82c1a6c98a4b32629fb5b990e
BLAKE2b-256 d776fed325b09e179c5118fca2326d25c991e3f4703954a92557aaf32596c5df

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