You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40-14Lines changed: 40 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -40,8 +40,10 @@
40
40
41
41
### Table of Contents
42
42
*[About](#about)
43
-
*[Usage](#usage)
43
+
*[Installation](#installation)
44
44
*[Setup](#setup)
45
+
*[Usage](#usage)
46
+
*[Testing](#testing)
45
47
*[Dependencies](#dependencies)
46
48
*[Troubleshooting](#troubleshooting)
47
49
@@ -50,24 +52,23 @@
50
52
<aname="about"></a>
51
53
### About
52
54
53
-
YFPY is a comprehensive wrapper around the Yahoo Fantasy Sports API. It allows for easy retrieval and parsing of almost any data you might wish to extract and use from any Yahoo fantasy league to which your Yahoo account has access (or for public leagues). The primary focus of this wrapper is on fantasy football (NFL), but it also supports usage with fantasy hockey (NHL), fantasy baseball (MLB), and fantasy basketball (NBA).
54
-
55
-
---
55
+
YFPY is a comprehensive wrapper around the Yahoo Fantasy Sports API. It allows for easy retrieval and parsing of almost any data you might wish to extract and use from any Yahoo fantasy league to which your Yahoo account has access (or for public leagues). The primary focus of this wrapper is on fantasy football (NFL), but it also supports usage with fantasy hockey (NHL), fantasy baseball (MLB), and fantasy basketball (NBA).
56
56
57
-
<aname="usage"></a>
58
-
### Usage
57
+
---
59
58
60
-
* In your project directory, run
59
+
<aname="installation"></a>
60
+
### Installation
61
61
62
-
```
62
+
* If you wish to use YFPY within another project, from within your project directory, run
63
+
```shell
63
64
pip install yfpy
64
65
```
65
66
66
67
or add `yfpy` to your project `requirements.txt`.
67
-
* Follow the instructions in the below [Setup](#setup) section.
68
-
* See `test/test.py` for fully functional code snippets within the query tests that demonstrate how to use YFPY.
69
-
* PLEASE NOTE: Assuming you followed the setup instructions correctly, the ***first*** time you use YFPY, a browser window will open up asking you to allow your app to access your Yahoo fantasy sports data. You ***MUST*** hit allow, and then copy the verification code that pops up into the command line prompt where it will now be asking for verification, hit enter, and the OAuth2 three-legged handshake should be complete and your data should have been successfully retrieved.
70
-
* YFPY should have now generated a `token.json` for you in the same directory where you stored your `private.json` credentials, and for all subsequent runs of your app, you should be able to keep retrieving Yahoo fantasy sports data using YFPY without re-verifying, since the generated refresh token should now just renew whenever you use the same `token.json` file to authenticate your app.
68
+
*If you wish to download and use YFPY locally, clone the git repository:
69
+
```shell
70
+
git clone git@github.com:uberfastman/yfpy.git
71
+
```
71
72
72
73
---
73
74
@@ -84,15 +85,40 @@ YFPY is a comprehensive wrapper around the Yahoo Fantasy Sports API. It allows f
84
85
*`API Permissions` (**Required**): check the `Fantasy Sports` checkbox. You can leave the `Read` option selected (appears in an accordion expansion underneath the `Fantasy Sports` checkbox once you selectit).
85
86
* Click the `Create App` button.
86
87
* Once the app is created, it should redirect you to a page for your app, which will show both a `Client ID` and a `Client Secret`.
87
-
* Make a copy of `examples/EXAMPLE-private.json`, rename it to just `private.json`, and copy the `Client ID` and `Client Secret` values to their respective fields (make sure the strings are wrapped regular quotes (`""`), NOT formatted quotes (`“”`)). The path to this file will be needed to point YFPY to your credentials.
88
+
* Make a copy of [`test/EXAMPLE-private.json`](test/EXAMPLE-private.json), rename it to just `private.json`, and copy the `Client ID` and `Client Secret` values to their respective fields (make sure the strings are wrapped regular quotes (`""`), NOT formatted quotes (`“”`)). The path to this file will be needed to point YFPY to your credentials.
88
89
* Now you should be ready to initialize the OAuth2 connection between YFPY your Yahoo account.
89
90
90
91
---
91
92
93
+
<a name="usage"></a>
94
+
### Usage
95
+
96
+
* Follow the instructions in the [Installation](#installation) and [Setup](#setup) sections.
97
+
* The ***first***time you use YFPY, a browser window will open up asking you to allow your app to access your Yahoo fantasy sports data. You ***MUST*** hit allow, and then copy the verification code that pops up into the command line prompt where it will now be asking for verification, hit enter, and the OAuth2 three-legged handshake should be complete and your data should have been successfully retrieved.
98
+
* YFPY should have now generated a `token.json`foryouin the same directory where you stored your `private.json` credentials, and for all subsequent runs of your app, you should be able to keep retrieving Yahoo fantasy sports data using YFPY without re-verifying, since the generated refresh token should now just renew whenever you use the same `token.json` file to authenticate your app.
99
+
100
+
---
101
+
102
+
<a name="testing"></a>
103
+
### Testing
104
+
105
+
YFPY has a collection of fully functional code snippets that can be run using [pytest](https://docs.pytest.org/en/6.2.x/). These snippets demonstrate how to use YFPY to retrieve your Yahoo Fantasy Sports data.
106
+
107
+
* See [`test/test_yfpy.py`](test/test_yfpy.py) for the example code snippets.
108
+
* Before running any tests, make a copy of [`test/EXAMPLE.env`](test/EXAMPLE.env) in the [`test`](test) directory and rename it to `.env`.
109
+
* Copy your Yahoo `Client ID` and `Client Secret` into the environment variables in`.env` so that pytest can use them when hitting the Yahoo Fantasy Sports API.
110
+
* You can invoke the pytest tests by first changing to the test directory from the root of the YFPY repository:
111
+
*`cd test`
112
+
*`pytest test_yfpy.py`
113
+
* If you want to run the tests from elsewhere, you will need to allow pytest to use interactive prompts:
114
+
*`pytest -s test/test_yfpy.py`
115
+
116
+
---
117
+
92
118
<a name="dependencies"></a>
93
119
### Dependencies
94
120
95
-
YFPY has only been tested on macOS, but is written to be platformagnostic. It runs only in Python 3, and has only been tested with Python 3.7.
121
+
YFPY has only been tested on macOS, but is written to be platform-agnostic. It runs only in Python 3, and has only been tested from Python 3.6 through Python 3.10.
96
122
97
123
Direct project dependencies can be viewed in`requirements.txt`, and all dependencies, including transitive dependencies, can be viewed in`dev-requirements.txt`.
0 commit comments