Skip to main content

Fanatics API Data Fetcher Tool

Project description

Fanatics API Data Fetcher

Fanatics API Data Fetcher is a Python tool designed to fetch data from the Fanatics API, retry failed requests, and convert the resulting JSON files into a CSV format.

Features

  • Fetch data based on a range of serial numbers.
  • Retry failed serial number requests.
  • Convert JSON files into a CSV file.

Installation

pip install fanatics-api

Usage

Fetch Data

To fetch data for a range of serial numbers:

fanatics-api --fetch --start 1 --end 100 --prefix B --time-sleep 1.0
  • --start: Start number for fetching data.
  • --end: End number for fetching data.
  • --prefix: Prefix letter for serial numbers (default is "B").
  • --time-sleep: Time sleep duration between requests in seconds.

Retry Failed Requests

To retry requests that failed previously:

fanatics-api --retry --failed-file failed.txt --time-sleep 1.0
  • --failed-file: Path to the failed file (default is "failed.txt").
  • --time-sleep: Time sleep duration between requests in seconds.

Convert JSON Files to CSV

To convert all JSON files in the data directory to a CSV file:

fanatics-api --to-csv --output-csv output.csv
  • --output-csv: Output CSV file name (default is "output.csv").

Example

fanatics-api --fetch --start 1 --end 200 --prefix B --time-sleep 2
fanatics-api --retry --failed-file failed.txt --time-sleep 2
fanatics-api --to-csv --output-csv results.csv

License

This project is licensed under the MIT License.

Fanatics API 数据抓取工具

Fanatics API 数据抓取工具是一个 Python 工具,旨在从 Fanatics API 获取数据、重试失败的请求,并将生成的 JSON 文件转换为 CSV 格式。

功能

  • 根据一系列序列号抓取数据。
  • 重试失败的序列号请求。
  • 将 JSON 文件转换为 CSV 文件。

安装

pip install fanatics-api

使用方法

抓取数据

抓取指定序列号范围内的数据:

fanatics-api --fetch --start 1 --end 100 --prefix B --time-sleep 1.0
  • --start: 开始抓取数据的编号。
  • --end: 结束抓取数据的编号。
  • --prefix: 序列号的前缀字母(默认为 "B")。
  • --time-sleep: 每次请求之间的休眠时间,以秒为单位。

重试失败的请求

重试之前失败的请求:

fanatics-api --retry --failed-file failed.txt --time-sleep 1.0
  • --failed-file: 失败文件的路径(默认为 "failed.txt")。
  • --time-sleep: 每次请求之间的休眠时间,以秒为单位。

将 JSON 文件转换为 CSV

data 目录中的所有 JSON 文件转换为一个 CSV 文件:

fanatics-api --to-csv --output-csv output.csv
  • --output-csv: 输出 CSV 文件的名称(默认为 "output.csv")。

示例

fanatics-api --fetch --start 1 --end 200 --prefix B --time-sleep 2
fanatics-api --retry --failed-file failed.txt --time-sleep 2
fanatics-api --to-csv --output-csv results.csv

许可证

本项目使用 MIT 许可证进行许可。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fanatics_api-2.5.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fanatics_api-2.5-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file fanatics_api-2.5.tar.gz.

File metadata

  • Download URL: fanatics_api-2.5.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for fanatics_api-2.5.tar.gz
Algorithm Hash digest
SHA256 23b1a493a1cc842a1dbb49b5968d50a8eeef85eb645c053b9a6d4aeed58fafaa
MD5 a73e4aff3166ec39ef68debe8659efd2
BLAKE2b-256 031fbab37a81e99b935a3c346709afbe7e2cc0c983b5a9ea38c4c3b9d7c9c6da

See more details on using hashes here.

File details

Details for the file fanatics_api-2.5-py3-none-any.whl.

File metadata

  • Download URL: fanatics_api-2.5-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for fanatics_api-2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 abda32d5bbe38d1d7dd3de42376c69b6ba6ce8def34b35bcb80ca6d306490bde
MD5 5f23a94367622e8b7b2eeb6b2eba6332
BLAKE2b-256 4809d7b8d97e88dc881e31a3293094aceb668f3c5853d4c3cd56b7d9a0c75602

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page