Skip to main content

Download NBA players headshots.

Project description

A simple package for download headshots of NBA players. It offers a premium headshots that feature a higher resolution and transparent background.

Installing

You can install the package by running the command below in terminal:

pip install nbaheadshot

Usage

An example of a python code:

#!/usr/bin/env python
#Filename: test.py
import os
import shutil
import nbaheadshot

# define the name of the directory to be created
path = "players"

try:
    os.mkdir(path)
except OSError:
    print ("Creation of the directory %s failed" % path)
else:
    print ("Successfully created the directory %s " % path)

def moveto(dst):
    return lambda src: shutil.move(src, dst)

action = {
    'jpg': moveto(path),
    'png': moveto(path),
}

src_dir = './'
for file in os.listdir(src_dir):
    ext = os.path.splitext(file)[1][1:]
    if ext in action:
        action[ext](os.path.join(src_dir, file))
        print('Done!')

Make sure you have these two files players.txt and missing_players.txt in the same directory as the script. Also, create a folder called players then run:

python3 test.py

License

License stuff is here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for nbaheadshot, version 1.1.3
Filename, size File type Python version Upload date Hashes
Filename, size nbaheadshot-1.1.3.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page