datafc 2.0.0__tar.gz → 2.1.0__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.
- {datafc-2.0.0 → datafc-2.1.0}/PKG-INFO +39 -22
- {datafc-2.0.0 → datafc-2.1.0}/README.md +925 -908
- {datafc-2.0.0 → datafc-2.1.0}/datafc/__init__.py +2 -1
- {datafc-2.0.0 → datafc-2.1.0}/datafc/exceptions.py +46 -46
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/__init__.py +82 -80
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/_parsers.py +560 -524
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/aio.py +2394 -2327
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_average_positions_data.py +91 -91
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_coordinates_data.py +102 -102
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_goal_networks_data.py +148 -148
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_incidents_data.py +87 -87
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_league_player_stats_data.py +165 -165
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_lineups_data.py +80 -80
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_match_data.py +84 -84
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_match_details_data.py +92 -92
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_match_h2h_data.py +82 -82
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_match_odds_data.py +73 -73
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_match_stats_data.py +80 -80
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_momentum_data.py +80 -80
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_past_matches_data.py +140 -140
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_player_career_stats_data.py +124 -124
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_player_data.py +132 -132
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_player_match_log_data.py +126 -126
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_player_national_team_data.py +108 -108
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_player_stats_data.py +126 -126
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_player_transfers_data.py +122 -122
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_pregame_form_data.py +109 -109
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_referee_stats_data.py +104 -104
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_search_data.py +93 -93
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_season_rounds_data.py +99 -99
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_seasons_data.py +86 -86
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_shots_data.py +80 -80
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_squad_data.py +124 -124
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_standings_data.py +80 -80
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_substitutions_data.py +80 -80
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_team_data.py +132 -132
- datafc-2.1.0/datafc/sofascore/fetch_team_match_history_data.py +108 -0
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_team_stats_data.py +123 -123
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_team_transfers_data.py +128 -128
- {datafc-2.0.0 → datafc-2.1.0}/datafc/sofascore/fetch_upcoming_matches_data.py +105 -105
- {datafc-2.0.0 → datafc-2.1.0}/datafc/utils/__init__.py +35 -35
- {datafc-2.0.0 → datafc-2.1.0}/datafc/utils/_async_client.py +164 -164
- {datafc-2.0.0 → datafc-2.1.0}/datafc/utils/_cache.py +142 -142
- {datafc-2.0.0 → datafc-2.1.0}/datafc/utils/_client.py +136 -136
- {datafc-2.0.0 → datafc-2.1.0}/datafc/utils/_config.py +93 -93
- {datafc-2.0.0 → datafc-2.1.0}/datafc/utils/_helpers.py +26 -26
- {datafc-2.0.0 → datafc-2.1.0}/datafc/utils/_save_files.py +142 -142
- {datafc-2.0.0 → datafc-2.1.0}/datafc/utils/_tournament_info.py +66 -66
- {datafc-2.0.0 → datafc-2.1.0}/datafc/utils/_validate.py +98 -98
- {datafc-2.0.0 → datafc-2.1.0}/datafc.egg-info/PKG-INFO +39 -22
- {datafc-2.0.0 → datafc-2.1.0}/datafc.egg-info/SOURCES.txt +1 -0
- {datafc-2.0.0 → datafc-2.1.0}/pyproject.toml +55 -55
- {datafc-2.0.0 → datafc-2.1.0}/LICENSE +0 -0
- {datafc-2.0.0 → datafc-2.1.0}/datafc.egg-info/dependency_links.txt +0 -0
- {datafc-2.0.0 → datafc-2.1.0}/datafc.egg-info/requires.txt +0 -0
- {datafc-2.0.0 → datafc-2.1.0}/datafc.egg-info/top_level.txt +0 -0
- {datafc-2.0.0 → datafc-2.1.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: datafc
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Fetch, process, and export structured football data.
|
|
5
5
|
Author-email: Uraz Akgül <urazdev@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -24,11 +24,11 @@ Requires-Dist: pytest>=8.0; extra == "dev"
|
|
|
24
24
|
Requires-Dist: pytest-mock>=3.12; extra == "dev"
|
|
25
25
|
Dynamic: license-file
|
|
26
26
|
|
|
27
|
-
# datafc v2.
|
|
27
|
+
# datafc v2.1.0
|
|
28
28
|
|
|
29
29
|
## Overview
|
|
30
30
|
|
|
31
|
-
`datafc` fetches, processes, and exports structured football data. It provides **
|
|
31
|
+
`datafc` fetches, processes, and exports structured football data. It provides **33 functions** covering tournament metadata, standings, squad rosters, match fixtures, shots, lineups, player heatmaps, odds, and more — all returning clean `pandas` DataFrames ready for analysis. Sofascore is currently the only supported data source.
|
|
32
32
|
|
|
33
33
|
> **Finding IDs:** `tournament_id` and `season_id` can be discovered two ways:
|
|
34
34
|
> - **From the URL:** navigating to a league page on Sofascore (e.g. `sofascore.com/.../trendyol-super-lig/52#id:63814`) shows `tournament_id=52` and `season_id=63814`.
|
|
@@ -60,6 +60,7 @@ Dynamic: license-file
|
|
|
60
60
|
| `player_stats_data` | Top player stats per team (goals, assists, key passes, …) |
|
|
61
61
|
| `squad_data` | Squad roster with age, height, market value, contract expiry |
|
|
62
62
|
| `upcoming_matches_data` | Upcoming fixtures for all teams in the standings |
|
|
63
|
+
| `team_match_history_data` | Full match history for a team across all competitions |
|
|
63
64
|
| `league_player_stats_data` | Wide-format player rankings, sortable by any metric |
|
|
64
65
|
|
|
65
66
|
### Matchweek
|
|
@@ -425,6 +426,26 @@ Dependencies: `standings_data`
|
|
|
425
426
|
|
|
426
427
|
---
|
|
427
428
|
|
|
429
|
+
#### `team_match_history_data`
|
|
430
|
+
|
|
431
|
+
Fetch the complete match history for a single team across all competitions.
|
|
432
|
+
|
|
433
|
+
```python
|
|
434
|
+
from datafc import team_match_history_data
|
|
435
|
+
|
|
436
|
+
df = team_match_history_data(team_id=4748) # Brazil
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
The `team_id` can be obtained from `standings_data()`, `squad_data()`, or `search_data()`.
|
|
440
|
+
|
|
441
|
+
Columns: `country`, `tournament`, `season`, `week`, `game_id`, `home_team`, `home_team_id`, `away_team`, `away_team_id`, `home_score_period1`, `home_score_period2`, `home_score_normaltime`, `home_score_display`, `home_score_current`, `away_score_period1`, `away_score_period2`, `away_score_normaltime`, `away_score_display`, `away_score_current`, `start_timestamp`, `status`.
|
|
442
|
+
|
|
443
|
+
> **Note:** Results span all competitions in Sofascore's database (league, cup, international). Filter by the `tournament` column to narrow down to a specific competition.
|
|
444
|
+
|
|
445
|
+
Dependencies: none
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
428
449
|
#### `upcoming_matches_data`
|
|
429
450
|
|
|
430
451
|
Fetch upcoming fixtures for all teams currently in the standings.
|
|
@@ -876,29 +897,25 @@ Columns: `referee_id`, `referee_name`, `tournament_id`, `tournament_name`, `stat
|
|
|
876
897
|
|
|
877
898
|
## Changelog
|
|
878
899
|
|
|
879
|
-
### v2.
|
|
880
|
-
|
|
881
|
-
**Chrome / Selenium removed — no browser required.** datafc now makes direct HTTP requests. Installation is simpler, and fetches are significantly faster than before.
|
|
882
|
-
|
|
883
|
-
**18 new functions.** `seasons_data`, `season_rounds_data`, `team_data`, `team_transfers_data`, `upcoming_matches_data`, `league_player_stats_data`, `match_details_data`, `match_h2h_data`, `pregame_form_data`, `incidents_data`, `average_positions_data`, `player_data`, `player_transfers_data`, `player_career_stats_data`, `player_national_team_data`, `player_match_log_data`, `referee_stats_data`, `search_data`.
|
|
884
|
-
|
|
885
|
-
**Async API.** All 32 functions are available in `datafc.aio` for parallel fetching with `asyncio.gather()`, letting you download an entire matchweek's worth of data concurrently.
|
|
886
|
-
|
|
887
|
-
**Disk caching.** Pass a `DiskCache` instance to any function to avoid re-fetching data you've already downloaded. Cached responses are returned instantly on subsequent calls.
|
|
900
|
+
### v2.1.0
|
|
888
901
|
|
|
889
|
-
|
|
902
|
+
- Added `team_match_history_data`: fetches the complete match history for a single team across all competitions using `team_id` directly (no standings dependency).
|
|
890
903
|
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
**Heatmap fetch no longer crashes on partial access errors.** `coordinates_data` now skips players that the API refuses to serve and returns data for everyone else. The function only raises an error if no player yields any coordinates at all.
|
|
894
|
-
|
|
895
|
-
**Exported filenames are human-readable.** JSON, Excel, and Parquet files now use the league name (e.g. `trendyol_superlig_shots_data.json`) instead of raw numeric IDs. Turkish and other non-ASCII characters are transliterated correctly — `Şampiyonlar` becomes `sampiyonlar`, not `ampiyonlar`.
|
|
896
|
-
|
|
897
|
-
**Valid JSON output.** Exported `.json` files no longer contain invalid `NaN` literals; they use `null` instead, making them compatible with every JSON parser and spreadsheet tool.
|
|
904
|
+
---
|
|
898
905
|
|
|
899
|
-
|
|
906
|
+
### v2.0.0
|
|
900
907
|
|
|
901
|
-
**
|
|
908
|
+
- **Chrome / Selenium removed — no browser required.** datafc now makes direct HTTP requests. Installation is simpler, and fetches are significantly faster than before.
|
|
909
|
+
- **18 new functions.** `seasons_data`, `season_rounds_data`, `team_data`, `team_transfers_data`, `upcoming_matches_data`, `league_player_stats_data`, `match_details_data`, `match_h2h_data`, `pregame_form_data`, `incidents_data`, `average_positions_data`, `player_data`, `player_transfers_data`, `player_career_stats_data`, `player_national_team_data`, `player_match_log_data`, `referee_stats_data`, `search_data`.
|
|
910
|
+
- **Async API.** All functions are available in `datafc.aio` for parallel fetching with `asyncio.gather()`, letting you download an entire matchweek's worth of data concurrently.
|
|
911
|
+
- **Disk caching.** Pass a `DiskCache` instance to any function to avoid re-fetching data you've already downloaded. Cached responses are returned instantly on subsequent calls.
|
|
912
|
+
- **Automatic rate limiting and retries.** All functions accept a `rate_limit` parameter. Temporary failures (rate limits, server errors) are retried automatically without any extra code on your side.
|
|
913
|
+
- **New Parquet export.** Use `save_parquet()` on any DataFrame returned by a fetch function to save output as `.parquet`. Requires `pyarrow` (`pip install datafc[parquet]`).
|
|
914
|
+
- **Heatmap fetch no longer crashes on partial access errors.** `coordinates_data` now skips players that the API refuses to serve and returns data for everyone else. The function only raises an error if no player yields any coordinates at all.
|
|
915
|
+
- **Exported filenames are human-readable.** JSON, Excel, and Parquet files now use the league name (e.g. `trendyol_superlig_shots_data.json`) instead of raw numeric IDs. Turkish and other non-ASCII characters are transliterated correctly — `Şampiyonlar` becomes `sampiyonlar`, not `ampiyonlar`.
|
|
916
|
+
- **Valid JSON output.** Exported `.json` files no longer contain invalid `NaN` literals; they use `null` instead, making them compatible with every JSON parser and spreadsheet tool.
|
|
917
|
+
- **Cleaner numeric columns.** Score fields, ratings, and market values that were previously returned as strings or empty strings are now proper numeric types (`null` when missing, not `""`).
|
|
918
|
+
- **Clearer errors.** When something goes wrong, the exception type tells you what happened: data not available, invalid parameter, API access error, rate limit hit, or server error.
|
|
902
919
|
|
|
903
920
|
### v1.5.0
|
|
904
921
|
|