Updated README.md
This commit is contained in:
parent
342a6d69cd
commit
f9a62afe5a
5
.gitignore
vendored
5
.gitignore
vendored
@ -3,5 +3,6 @@ __pycache__
|
||||
.pytest_cache
|
||||
dist
|
||||
|
||||
# Minor testing
|
||||
test.py
|
||||
# Miscellaneous
|
||||
test.py
|
||||
*.afphoto
|
44
README.md
44
README.md
@ -1,18 +1,29 @@
|
||||
# Ergast-py
|
||||
<h1 align="center"><b>Ergast-Py</b></h1>
|
||||
|
||||
![Stars](https://img.shields.io/github/stars/Samuel-Roach/ergast-py?color=purple&style=for-the-badge) ![Size](https://img.shields.io/github/languages/code-size/Samuel-Roach/ergast-py?style=for-the-badge) ![Commits](https://img.shields.io/github/commit-activity/m/Samuel-Roach/ergast-py?color=orange&style=for-the-badge) ![PyPI](https://img.shields.io/pypi/v/ergast-py?color=green&style=for-the-badge)
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/github/stars/Samuel-Roach/ergast-py?color=purple&style=for-the-badge"/>
|
||||
<img src="https://img.shields.io/github/languages/code-size/Samuel-Roach/ergast-py?style=for-the-badge"/>
|
||||
<img src="https://img.shields.io/github/commit-activity/m/Samuel-Roach/ergast-py?color=orange&style=for-the-badge"/>
|
||||
<img src="https://img.shields.io/pypi/v/ergast-py?color=green&style=for-the-badge"/>
|
||||
</p>
|
||||
|
||||
A comprehensive Python wrapper for the Ergast API. Built for easy use and functionality, Ergast-py aims to bring the Ergast API into the Python network as seemlessly as possible.
|
||||
|
||||
## What is Ergast?
|
||||
> NOTE: Ergast-py is still in active development, so all features are experimental and subject to change. Differences may occur between what is documented in this README.md and what is actually available in Ergast-py
|
||||
|
||||
<p align="center">
|
||||
<img width="500" src="images/../img/banner.png" alt="Command prompt example of how to use Ergast">
|
||||
</p>
|
||||
|
||||
# What is Ergast?
|
||||
|
||||
[Ergast](http://ergast.com/mrd/) is a free, experimental API for accessing motor-racing data, dating back to the beginning of World Championships in 1950. The website provides plenty of detail into how effective the API can be, and the many options that are available for data gathering using it.
|
||||
|
||||
## Why should I use Ergast-Py?
|
||||
# Why should I use Ergast-Py?
|
||||
|
||||
Ergast-Py provides a clean, Python orientated wrapper for this API. It has been designed to remove the heavy lifting of handling the API formatting behind the scenes, allowing developers to easily access the data that is relevant to them. All the data is conformed into clean class code, allowing for users to keep a Python-centric mindset whilst developing.
|
||||
|
||||
## How to install
|
||||
# How to install
|
||||
|
||||
Ergast-py is a [pip package](https://pypi.org/project/ergast-py/), so can be installed with the pip command:
|
||||
|
||||
@ -20,7 +31,7 @@ Ergast-py is a [pip package](https://pypi.org/project/ergast-py/), so can be ins
|
||||
pip install ergast-py
|
||||
```
|
||||
|
||||
## Usage
|
||||
# Usage
|
||||
|
||||
Once ergast-py is installed on your system you can then begin using the library in querying the ergast API. To begin, initialise an instance of the ``Ergast()`` class.
|
||||
|
||||
@ -50,7 +61,7 @@ felipe_massa = e.driver_str("massa").get_drivers()
|
||||
constructor_standings = e.season().standing(3).get_constructor_standings()
|
||||
```
|
||||
|
||||
## Structure and Types
|
||||
# Structure and Types
|
||||
|
||||
Ergast-py has many models which allow the user to more effectively use and manipulate the data available to them through Ergast. All models of data are available through ``.models.xyz``.
|
||||
|
||||
@ -79,7 +90,7 @@ Ergast-py has many models which allow the user to more effectively use and manip
|
||||
|
||||
</details>
|
||||
|
||||
## Query building
|
||||
# Query building
|
||||
|
||||
There are 3 types of query available in the ``Ergast()`` class. <b>FILTER</b> functions build up the query, by filtering down the data that you will receive. <b>PAGING</b> functions control the flow of data if there is excessive amounts, limiting it to not overflow the API. <b>RETURN</b> functions detail what type of data you're expecting back from the query.
|
||||
|
||||
@ -136,21 +147,34 @@ More detail on the available functions within the ``Ergast()`` class is availabl
|
||||
| Name | Return Type |
|
||||
| ------------------------- | --------------------- |
|
||||
| get_circuits | list[Circuit] |
|
||||
| get_circuit | Circuit |
|
||||
| get_constructors | list[Constructor] |
|
||||
| get_constructor | Constructor |
|
||||
| get_drivers | list[Driver] |
|
||||
| get_qualifying | list[Race] |
|
||||
| get_driver | Driver |
|
||||
| get_qualifyings | list[Race] |
|
||||
| get_qualifying | Race |
|
||||
| get_sprints | list[Race] |
|
||||
| get_sprint | Race |
|
||||
| get_results | list[Race] |
|
||||
| get_result | Race |
|
||||
| get_races | list[Race] |
|
||||
| get_race | Race |
|
||||
| get_seasons | list[Season] |
|
||||
| get_season | Season |
|
||||
| get_statuses | list[Status] |
|
||||
| get_status | Status |
|
||||
| get_driver_standings | list[StandingsList] |
|
||||
| get_driver_standing | StandingsList |
|
||||
| get_constructor_standings | list[StandingsList] |
|
||||
| get_constructor_standing | StandingsList |
|
||||
| get_laps | list[Race] |
|
||||
| get_lap | Race |
|
||||
| get_pit_stops | list[Race] |
|
||||
| get_pit_stop | Race |
|
||||
|
||||
</details>
|
||||
|
||||
## Credits
|
||||
# Credits
|
||||
|
||||
This library would not be possible without the freely available [Ergast](http://ergast.com/mrd/) API. For full information about the API and it's responsible use, please refer to their website. [Poetry](https://python-poetry.org/) was used for package building and releasing.
|
||||
|
@ -147,54 +147,108 @@ class Ergast():
|
||||
self.reset()
|
||||
return circuits
|
||||
|
||||
def get_circuit(self) -> Circuit:
|
||||
circuits_json = self.requester.get_circuits(self.params)
|
||||
circuits = self.type_constructor.construct_circuits(circuits_json)
|
||||
self.reset()
|
||||
return circuits[0]
|
||||
|
||||
def get_constructors(self) -> list[Constructor]:
|
||||
constructors_json = self.requester.get_constructors(self.params)
|
||||
constructors = self.type_constructor.construct_constructors(constructors_json)
|
||||
self.reset()
|
||||
return constructors
|
||||
|
||||
def get_constructor(self) -> Constructor:
|
||||
constructors_json = self.requester.get_constructors(self.params)
|
||||
constructors = self.type_constructor.construct_constructors(constructors_json)
|
||||
self.reset()
|
||||
return constructors[0]
|
||||
|
||||
def get_drivers(self) -> list[Driver]:
|
||||
drivers_json = self.requester.get_drivers(self.params)
|
||||
drivers = self.type_constructor.construct_drivers(drivers_json)
|
||||
self.reset()
|
||||
return drivers
|
||||
|
||||
def get_qualifying(self) -> list[Race]:
|
||||
def get_driver(self) -> Driver:
|
||||
drivers_json = self.requester.get_drivers(self.params)
|
||||
drivers = self.type_constructor.construct_drivers(drivers_json)
|
||||
self.reset()
|
||||
return drivers[0]
|
||||
|
||||
def get_qualifyings(self) -> list[Race]:
|
||||
qualify_json = self.requester.get_qualifying(self.params)
|
||||
qualifying = self.type_constructor.construct_races(qualify_json)
|
||||
self.reset()
|
||||
return qualifying
|
||||
|
||||
def get_qualifying(self) -> Race:
|
||||
qualify_json = self.requester.get_qualifying(self.params)
|
||||
qualifying = self.type_constructor.construct_races(qualify_json)
|
||||
self.reset()
|
||||
return qualifying[0]
|
||||
|
||||
def get_sprints(self) -> list[Race]:
|
||||
sprint_json = self.requester.get_sprints(self.params)
|
||||
sprint = self.type_constructor.construct_races(sprint_json)
|
||||
self.reset()
|
||||
return sprint
|
||||
|
||||
def get_sprint(self) -> Race:
|
||||
sprint_json = self.requester.get_sprints(self.params)
|
||||
sprint = self.type_constructor.construct_races(sprint_json)
|
||||
self.reset()
|
||||
return sprint[0]
|
||||
|
||||
def get_results(self) -> list[Race]:
|
||||
results_json = self.requester.get_results(self.params)
|
||||
results = self.type_constructor.construct_races(results_json)
|
||||
self.reset()
|
||||
return results
|
||||
|
||||
def get_result(self) -> Race:
|
||||
results_json = self.requester.get_results(self.params)
|
||||
results = self.type_constructor.construct_races(results_json)
|
||||
self.reset()
|
||||
return results[0]
|
||||
|
||||
def get_races(self) -> list[Race]:
|
||||
races_json = self.requester.get_races(self.params)
|
||||
races = self.type_constructor.construct_races(races_json)
|
||||
self.reset()
|
||||
return races
|
||||
|
||||
def get_race(self) -> Race:
|
||||
races_json = self.requester.get_races(self.params)
|
||||
races = self.type_constructor.construct_races(races_json)
|
||||
self.reset()
|
||||
return races[0]
|
||||
|
||||
def get_seasons(self) -> list[Season]:
|
||||
seasons_json = self.requester.get_seasons(self.params)
|
||||
seasons = self.type_constructor.construct_seasons(seasons_json)
|
||||
self.reset()
|
||||
return seasons
|
||||
|
||||
def get_season(self) -> Season:
|
||||
seasons_json = self.requester.get_seasons(self.params)
|
||||
seasons = self.type_constructor.construct_seasons(seasons_json)
|
||||
self.reset()
|
||||
return seasons[0]
|
||||
|
||||
def get_statuses(self) -> list[Status]:
|
||||
statuses_json = self.requester.get_statuses(self.params)
|
||||
statuses = self.type_constructor.construct_statuses(statuses_json)
|
||||
self.reset()
|
||||
return statuses
|
||||
|
||||
def get_status(self) -> Status:
|
||||
statuses_json = self.requester.get_statuses(self.params)
|
||||
statuses = self.type_constructor.construct_statuses(statuses_json)
|
||||
self.reset()
|
||||
return statuses[0]
|
||||
|
||||
# Standings Queries
|
||||
|
||||
def get_driver_standings(self) -> list[StandingsList]:
|
||||
@ -203,12 +257,24 @@ class Ergast():
|
||||
self.reset()
|
||||
return standings_lists
|
||||
|
||||
def get_driver_standing(self) -> StandingsList:
|
||||
standings_lists_json = self.requester.get_driver_standings(self.params)
|
||||
standings_lists = self.type_constructor.construct_standings_lists(standings_lists_json)
|
||||
self.reset()
|
||||
return standings_lists[0]
|
||||
|
||||
def get_constructor_standings(self) -> list[StandingsList]:
|
||||
standings_lists_json = self.requester.get_constructor_standings(self.params)
|
||||
standings_lists = self.type_constructor.construct_standings_lists(standings_lists_json)
|
||||
self.reset()
|
||||
return standings_lists
|
||||
|
||||
def get_constructor_standing(self) -> StandingsList:
|
||||
standings_lists_json = self.requester.get_constructor_standings(self.params)
|
||||
standings_lists = self.type_constructor.construct_standings_lists(standings_lists_json)
|
||||
self.reset()
|
||||
return standings_lists[0]
|
||||
|
||||
# Laps and Pit Stops Queries
|
||||
|
||||
def get_laps(self) -> list[Race]:
|
||||
@ -217,8 +283,20 @@ class Ergast():
|
||||
self.reset()
|
||||
return laps
|
||||
|
||||
def get_lap(self) -> Race:
|
||||
laps_json = self.requester.get_laps(self.params)
|
||||
laps = self.type_constructor.construct_races(laps_json)
|
||||
self.reset()
|
||||
return laps[0]
|
||||
|
||||
def get_pit_stops(self) -> list[Race]:
|
||||
pit_stops_json = self.requester.get_pit_stops(self.params)
|
||||
pit_stops = self.type_constructor.construct_races(pit_stops_json)
|
||||
self.reset()
|
||||
return pit_stops
|
||||
return pit_stops
|
||||
|
||||
def get_pit_stop(self) -> Race:
|
||||
pit_stops_json = self.requester.get_pit_stops(self.params)
|
||||
pit_stops = self.type_constructor.construct_races(pit_stops_json)
|
||||
self.reset()
|
||||
return pit_stops[0]
|
BIN
img/banner.png
Normal file
BIN
img/banner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 191 KiB |
Reference in New Issue
Block a user