Skip to main content

Python library for integrating with the MLS (Major League Soccer) API.

Project description

MLS API Python Package Version

Python library for integrating with MLS API functionality.

Requirements

Python 2.7 and later.

Setup

You can install this package by using the pip tool and installing:

$ pip install mls-api

Or:

$ easy_install mls-api

Usage Example

import mls_api
from dotenv import load_dotenv
import os

## Loads environment variables from .env
load_dotenv('.env')

username = os.getenv('_USERNAME')
password = os.getenv('_PASSWORD')

## Authentication
mls_api.login(username, password)

## Retrieve MLS Real-Time Data
mls_rtd = mls_api.get_rtd()
print(mls_rtd)

## Retrieve MLS Historical Data
mls_historical = mls_api.get_historical_data()
print(mls_historical)

## Retrieve MLS Players Data
limit = 5
offset = 5

mls_players_l = mls_api.get_players(limit=limit)
print(mls_players_l)

mls_players = mls_api.get_players(limit=limit, offset=offset)
print(mls_players)

## Retrieve MLS Assist Data
mls_assists = mls_api.get_assists()
print(mls_assists)

## Retrieve MLS Offence Data
mls_offence = mls_api.get_offence()
print(mls_offence)

## Retrieve MLS Top Scorers Data
mls_top_scorer = mls_api.get_top_scorer()
print(mls_top_scorer)

## Retrieve MLS Teams Data
mls_teams = mls_api.get_teams()
print(mls_teams)

## Retrieve MLS Fixtures Data
mls_fixtures = mls_api.get_fixtures()
print(mls_fixtures)

## Retrieve MLS Standings Data
mls_standings = mls_api.get_standings()
print(mls_standings)

## Retrieve MLS Latest News Data
mls_latest_news = mls_api.get_latest_news()
print(mls_latest_news)

Setting up an MLS API Account

Sign up for a self-service user account.

Using the MLS API

You can read the API documentation to understand what’s possible with the MLS API. If you need further assistance, don’t hesitate to contact us.

License

This project is licensed under the MIT License.

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

mls-api-2.0.3.tar.gz (16.0 kB view hashes)

Uploaded Source

Built Distribution

mls_api-2.0.3-py3-none-any.whl (18.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page