This function creates a connection object which stores parameters and gets a login-cookie if available
Usage
mfl_connect(
season = NULL,
league_id = NULL,
APIKEY = NULL,
user_name = NULL,
password = NULL,
user_agent = NULL,
rate_limit = TRUE,
rate_limit_number = NULL,
rate_limit_seconds = NULL,
...
)
Arguments
- season
Season to access on MFL - if missing, will guess based on system date (current year if March or later, otherwise previous year)
- league_id
league_id Numeric ID parameter for each league, typically found in the URL
- APIKEY
APIKEY - optional - allows access to private leagues. Key is unique for each league and accessible from Developer's API page (currently assuming one league at a time)
- user_name
MFL user_name - optional - when supplied in conjunction with a password, will attempt to retrieve authentication token
- password
MFL password - optional - when supplied in conjunction with user_name, will attempt to retrieve authentication token
- user_agent
A string representing the user agent to be used to identify calls - may find improved rate_limits if verified token
- rate_limit
TRUE by default, pass FALSE to turn off rate limiting
- rate_limit_number
number of calls per
rate_limit_seconds
, suggested is 60 calls per 60 seconds- rate_limit_seconds
number of seconds as denominator for rate_limit
- ...
silently swallows up unused arguments
Examples
# \donttest{
mfl_connect(season = 2020, league_id = 54040)
#> <MFL connection 2020_54040>
#> List of 5
#> $ platform : chr "MFL"
#> $ season : num 2020
#> $ league_id : chr "54040"
#> $ APIKEY : NULL
#> $ auth_cookie: NULL
#> - attr(*, "class")= chr "mfl_conn"
mfl_connect(season = 2019, league_id = 54040, rate_limit = FALSE)
#> <MFL connection 2019_54040>
#> List of 5
#> $ platform : chr "MFL"
#> $ season : num 2019
#> $ league_id : chr "54040"
#> $ APIKEY : NULL
#> $ auth_cookie: NULL
#> - attr(*, "class")= chr "mfl_conn"
# }