uberfastman / fantasy-football-metrics-weekly-report

Command line application to create weekly reports (containing stats, metrics, and rankings) for Fantasy Football leagues on the following platforms: Yahoo, ESPN, CBS, Sleeper, Fleaflicker
GNU General Public License v3.0
199 stars 49 forks source link

SSL validation error for nflarrest.com #88

Closed adamlaz closed 4 years ago

adamlaz commented 4 years ago

Hey - I'm getting the below error when trying to generate a report. I'm getting ESPN data successfully, but can't seem to get past this.... Any help would be appreciated!

fantasy-football-metrics-weekly-report > python main.py   
Generate report for default league? (y/n) -> y
Generate report for default week? (y/n) -> y
2020-09-09 09:49:51,191 - report.builder - INFO - 
Generating Espn Fantasy Football report with settings:
    league id: XXREDACTED
    game id: nfl
    week: selected/default
    save_data: False
    refresh_web_data: False
    playoff_prob_sims: None
    break_ties: False
    dq_ce: False
    dev_offline: False
    test: False
on Sep 09, 2020...
2020-09-09 09:49:51,191 - report.builder - INFO - Retrieving fantasy football data from Espn API...
2020-09-09 09:50:20,014 - report.builder - INFO - ...retrieved all fantasy football data from Espn API in 0:00:28.822987

2020-09-09 09:50:20,015 - report.builder - INFO - Retrieving bad boy data from http://nflarrest.com website...
2020-09-09 09:50:20,146 - urllib3.connection - WARNING - Certificate did not match expected hostname: nflarrest.com. Certificate: {'subject': ((('countryName', 'US'),), (('stateOrProvinceName', 'California'),), (('localityName', 'San Francisco'),), (('organizationName', 'GitHub, Inc.'),), (('commonName', 'www.github.com'),)), 'issuer': ((('countryName', 'US'),), (('organizationName', 'DigiCert Inc'),), (('organizationalUnitName', 'www.digicert.com'),), (('commonName', 'DigiCert SHA2 High Assurance Server CA'),)), 'version': 3, 'serialNumber': '02493E07FA9E375A2DBBC61D94430FCF', 'notBefore': 'May  6 00:00:00 2020 GMT', 'notAfter': 'Apr 14 12:00:00 2022 GMT', 'subjectAltName': (('DNS', 'www.github.com'), ('DNS', '*.github.com'), ('DNS', 'github.com'), ('DNS', '*.github.io'), ('DNS', 'github.io'), ('DNS', '*.githubusercontent.com'), ('DNS', 'githubusercontent.com')), 'OCSP': ('http://ocsp.digicert.com',), 'caIssuers': ('http://cacerts.digicert.com/DigiCertSHA2HighAssuranceServerCA.crt',), 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ha-server-g6.crl', 'http://crl4.digicert.com/sha2-ha-server-g6.crl')}
Traceback (most recent call last):
  File "/XXREDACTED/userDir/.pyenv/versions/3.7.7/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/XXREDACTED/userDir/.pyenv/versions/3.7.7/lib/python3.7/site-packages/urllib3/connectionpool.py", line 381, in _make_request
    self._validate_conn(conn)
  File "/XXREDACTED/userDir/.pyenv/versions/3.7.7/lib/python3.7/site-packages/urllib3/connectionpool.py", line 976, in _validate_conn
    conn.connect()
  File "/XXREDACTED/userDir/.pyenv/versions/3.7.7/lib/python3.7/site-packages/urllib3/connection.py", line 396, in connect
    _match_hostname(cert, self.assert_hostname or server_hostname)
  File "/XXREDACTED/userDir/.pyenv/versions/3.7.7/lib/python3.7/site-packages/urllib3/connection.py", line 406, in _match_hostname
    match_hostname(cert, asserted_hostname)
  File "/XXREDACTED/userDir/.pyenv/versions/3.7.7/lib/python3.7/ssl.py", line 334, in match_hostname
    % (hostname, ', '.join(map(repr, dnsnames))))
ssl.SSLCertVerificationError: ("hostname 'nflarrest.com' doesn't match either of 'www.github.com', '*.github.com', 'github.com', '*.github.io', 'github.io', '*.githubusercontent.com', 'githubusercontent.com'",)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/XXREDACTED/userDir/.pyenv/versions/3.7.7/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/XXREDACTED/userDir/.pyenv/versions/3.7.7/lib/python3.7/site-packages/urllib3/connectionpool.py", line 725, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/XXREDACTED/userDir/.pyenv/versions/3.7.7/lib/python3.7/site-packages/urllib3/util/retry.py", line 439, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: MyHTTPSConnectionPool(host='nflarrest.com', port=443): Max retries exceeded with url: /api/v1/team/arrests/ARI (Caused by SSLError(SSLCertVerificationError("hostname 'nflarrest.com' doesn't match either of 'www.github.com', '*.github.com', 'github.com', '*.github.io', 'github.io', '*.githubusercontent.com', 'githubusercontent.com'")))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 253, in <module>
    options.get("test", False))
  File "main.py", line 166, in select_league
    test=test)
  File "/XXREDACTED/userDir/dev/fantasy-football-metrics-weekly-report/report/builder.py", line 129, in __init__
    self.bad_boy_stats = self.league.get_bad_boy_stats(self.save_data, self.dev_offline, self.refresh_web_data)
  File "/XXREDACTED/userDir/dev/fantasy-football-metrics-weekly-report/dao/base.py", line 222, in get_bad_boy_stats
    refresh=refresh
  File "/XXREDACTED/userDir/dev/fantasy-football-metrics-weekly-report/calculate/bad_boy_stats.py", line 70, in __init__
    response = requests.get(nfl_arrest_api_team_base_url + team_abbr, headers=headers)
  File "/XXREDACTED/userDir/.pyenv/versions/3.7.7/lib/python3.7/site-packages/requests/api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "/XXREDACTED/userDir/.pyenv/versions/3.7.7/lib/python3.7/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/XXREDACTED/userDir/.pyenv/versions/3.7.7/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/XXREDACTED/userDir/.pyenv/versions/3.7.7/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/XXREDACTED/userDir/.pyenv/versions/3.7.7/lib/python3.7/site-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: MyHTTPSConnectionPool(host='nflarrest.com', port=443): Max retries exceeded with url: /api/v1/team/arrests/ARI (Caused by SSLError(SSLCertVerificationError("hostname 'nflarrest.com' doesn't match either of 'www.github.com', '*.github.com', 'github.com', '*.github.io', 'github.io', '*.githubusercontent.com', 'githubusercontent.com'")))
uberfastman commented 4 years ago

Hi @adamlaz, thanks so much for reporting the issue! I actually (just finally) am getting to my annual "what's broken in my FF report app this year" check, and lo and behold, I ran into the same issue as you. It is because the API being used for the arrest data appears to no longer be publicly accessible, so the calls to it are failing.

I have already implemented a solution (you will be able to simply turn off that functionality completely to skip over it), which I will be pushing soon. I'll close this issue once it's pushed! Then that should give me time to try and figure out if I can find an alternative to the API and implement it.

adamlaz commented 4 years ago

That's awesome to hear @uberfastman!

Excited to play with this a bit, so I'll be keeping an eye on the repo for any updates šŸ¤“: šŸŽ‰ . It's been a few years since I've done anything non-trivial in Python. Maybe as I poke around I can think of a way I can help add some functionality and will open a PR.

Sideote: thank you for actually replying thoughtfully to my issue! I always feel a bit weird opening an issue on a random repo with a dump of logs when I can't even get it to run locally. I was happy to read that this wasn't just some dumb thing I was doing on my machine šŸ˜†

uberfastman commented 4 years ago

@adamlaz I'm always glad to get input, and anything you feel like contributing with PRs would be great!

Also, I've pushed release v8.0.1-beta, which includes the default disabling of the Bad Boy rankings while I explore a fix for that missing API. I guess I can always go back to my original implementation when I was scraping the USA Today data myself, but it's always nicer and easier to maintain with an API.

I'm closing the issue since it should be fixed for you, but please reopen it if it doesn't!

uberfastman commented 4 years ago

@adamlaz just FYI, I fixed the NFL arrest data retrieval, so the bad boy data has been reinstated as part of the app.

adamlaz commented 4 years ago

@uberfastman thanks! Going to try and find some time this weekend to play with all this.

uberfastman commented 4 years ago

@adamlaz awesome, I look forward to seeing what you come up with, as Iā€™m always looking for fun new metrics to add! I apologize ahead of time for the massive pain the ass it is to add a metric... the overall app is still rather messy and could probably use yet another massive refactor/overhauls haha.

Let me know if you run into any other setup issue!