baronet2 / firstcyclingapi Goto Github PK
View Code? Open in Web Editor NEWAn unofficial Python API wrapper for firstcycling.com
Home Page: https://firstcyclingapi.readthedocs.io/en/latest/
License: MIT License
An unofficial Python API wrapper for firstcycling.com
Home Page: https://firstcyclingapi.readthedocs.io/en/latest/
License: MIT License
Hi, thx for the library, it is really helping. In race/race.py there is
self._get_endpoint(endpoint=RaceEditionResults, l=classification_num, e=zero_padded_stage_num)
And in constants.py I see
classifications = {'general': 1, 'youth': 2, 'points': 3, 'mountain': 4, 'sprint': 6}
So I suppose that l=1 should give me the general. However, it does not. FirstCycling seems not to work anymore like that. Can you confirm the current state?
When I run py.test in the root directory I get the following result.
Python version is 3.9.7
================================================= test session starts ==================================================
platform darwin -- Python 3.9.7, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /Users/admin/Documents/GitHub/FirstCyclingAPI
plugins: anyio-2.2.0
collected 0 items / 3 errors
======================================================== ERRORS ========================================================
_________________________________________ ERROR collecting tests/test_race.py __________________________________________
ImportError while importing test module '/Users/admin/Documents/GitHub/FirstCyclingAPI/tests/test_race.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../opt/anaconda3/lib/python3.9/importlib/init.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_race.py:1: in
from first_cycling_api import Race, RaceEdition
first_cycling_api/init.py:8: in
from .rider import Rider
first_cycling_api/rider/init.py:23: in
from .rider import Rider
first_cycling_api/rider/rider.py:3: in
from ..api import fc
first_cycling_api/api.py:8: in
from slumber import API
E ModuleNotFoundError: No module named 'slumber'
________________________________________ ERROR collecting tests/test_ranking.py ________________________________________
ImportError while importing test module '/Users/admin/Documents/GitHub/FirstCyclingAPI/tests/test_ranking.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../opt/anaconda3/lib/python3.9/importlib/init.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_ranking.py:1: in
from first_cycling_api import Ranking
first_cycling_api/init.py:8: in
from .rider import Rider
first_cycling_api/rider/init.py:23: in
from .rider import Rider
first_cycling_api/rider/rider.py:3: in
from ..api import fc
first_cycling_api/api.py:8: in
from slumber import API
E ModuleNotFoundError: No module named 'slumber'
_________________________________________ ERROR collecting tests/test_rider.py _________________________________________
ImportError while importing test module '/Users/admin/Documents/GitHub/FirstCyclingAPI/tests/test_rider.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../opt/anaconda3/lib/python3.9/importlib/init.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_rider.py:1: in
from first_cycling_api import Rider
first_cycling_api/init.py:8: in
from .rider import Rider
first_cycling_api/rider/init.py:23: in
from .rider import Rider
first_cycling_api/rider/rider.py:3: in
from ..api import fc
first_cycling_api/api.py:8: in
from slumber import API
E ModuleNotFoundError: No module named 'slumber'
=============================================== short test summary info ================================================
ERROR tests/test_race.py
ERROR tests/test_ranking.py
ERROR tests/test_rider.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================== 3 errors in 15.89s ==================================================
Hey there, just wondering if this library is available on PyPi? I don't see anything in the docs about how to install this library.
Originally posted by bfransol June 4, 2022
Hello,
I'm currently trying to use this repository for my studies, however I get the following error whent trying to retreive data from Rider.
code:
from first_cycling_api import Rider
roglic = Rider(16672)
print(roglic.best_results())
error:
Traceback (most recent call last):
File "C:/Users/2de Master/Predictive and Prescriptive Analytics/FirstCyclingAPI-main/ExtractData.py", line 10, in <module>
print(roglic.best_results())
File "C:\Users\2de Master\Predictive and Prescriptive Analytics\FirstCyclingAPI-main\first_cycling_api\rider\rider.py", line 43, in best_results
return self._get_endpoint(high=1)
File "C:\Users\2de Master\Predictive and Prescriptive Analytics\FirstCyclingAPI-main\first_cycling_api\objects.py", line 25, in _get_endpoint
return endpoint(response)
File "C:\Users\2de Master\Predictive and Prescriptive Analytics\FirstCyclingAPI-main\first_cycling_api\endpoints.py", line 39, in __init__
self._parse_result()
File "C:\Users\2de Master\Predictive and Prescriptive Analytics\FirstCyclingAPI-main\first_cycling_api\endpoints.py", line 43, in _parse_result
self._parse_soup()
File "C:\Users\2de Master\Predictive and Prescriptive Analytics\FirstCyclingAPI-main\first_cycling_api\rider\endpoints.py", line 25, in _parse_soup
self._get_sidebar_details()
File "C:\Users\2de Master\Predictive and Prescriptive Analytics\FirstCyclingAPI-main\first_cycling_api\rider\endpoints.py", line 44, in _get_sidebar_details
details = pd.Series(details_df.set_index('Information')['Information.1'])
File "C:\Users\anaconda3\lib\site-packages\pandas\util\_decorators.py", line 311, in wrapper
return func(*args, **kwargs)
File "C:\Users\anaconda3\lib\site-packages\pandas\core\frame.py", line 5451, in set_index
raise KeyError(f"None of {missing} are in the columns")
KeyError: "None of ['Information'] are in the columns"
I was wondering if someone could help me out with it.
Thanks in advance!
Returning Endpoint
instances rather than storing these as properties introduces unnecessary complexity to the Rider
and Race
sections. It would be better to return the relevant result directly, or return the raw response if it is not being parsed.
For example,Race(XX).victory_table().table
should become Race(XX).victory_table
.
Such calls should automatically update properties common to all endpoints of that instance, such as Race(XX).header_details
. To avoid losing data, all raw responses should be accessible somehow.
Where we accept parameters for the methods, we can separate these into separate attributes or use dictionary syntax instead. For example, Rider(XX).year_results(2020).results_df
should become Rider(XX).year_results[2020]
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.