ffbot 1.2.6__tar.gz → 1.2.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ffbot
3
- Version: 1.2.6
3
+ Version: 1.2.8
4
4
  Summary: Automate playing Yahoo Fantasy Football
5
5
  Home-page: https://github.com/amarvin/fantasy-football-bot
6
6
  Author: Alex Marvin
@@ -0,0 +1 @@
1
+ VERSION = "1.2.8"
@@ -1,3 +1,4 @@
1
+ import re
1
2
  from datetime import datetime
2
3
  from io import StringIO
3
4
 
@@ -127,8 +128,10 @@ def scrape(league, is_IDP: bool = False):
127
128
  df2 = pd.read_html(StringIO(html))[0]
128
129
  for _, row2 in df2.iterrows():
129
130
  week = "Week {}".format(row2["Week"])
130
- points = row2["Fan Pts"]
131
- if points[0] == "*":
131
+ points = row2.get("Fan Pts")
132
+ if points is None:
133
+ continue
134
+ elif points[0] == "*":
132
135
  # Game hasn't occured yet
133
136
  row[week] = float(points[1:])
134
137
  # row[week + ' projection'] = float(points[1:])
@@ -149,6 +152,9 @@ def scrape(league, is_IDP: bool = False):
149
152
  tqdm.pandas(desc="Scraping weekly forecasts")
150
153
  df = df.progress_apply(get_projections, axis=1)
151
154
 
155
+ # Remove players without projections
156
+ df = df[~pd.isna(df["Week 1"])]
157
+
152
158
  # Reorder columns
153
159
  columns = list(df.columns)
154
160
  columns[2], columns[1] = columns[1], columns[2]
@@ -188,8 +194,9 @@ def current_week():
188
194
  s.headers["User-Agent"] = generate_user_agent()
189
195
  r = s.get(url)
190
196
  soup = bs(r.text, "lxml")
191
- span = soup.select_one("li.Navitem.current a.Navtarget")
192
- week = span.text.split()[1]
197
+ matchups = soup.select_one("#matchupweek .matchups-body")
198
+ weeks = re.findall(r"Week (\d+)", matchups.text)
199
+ week = weeks[0]
193
200
  week = int(week)
194
201
 
195
202
  return week
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ffbot
3
- Version: 1.2.6
3
+ Version: 1.2.8
4
4
  Summary: Automate playing Yahoo Fantasy Football
5
5
  Home-page: https://github.com/amarvin/fantasy-football-bot
6
6
  Author: Alex Marvin
@@ -1 +0,0 @@
1
- VERSION = "1.2.6"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes