From be21502051af70bf7ea14b308bea9cb5454aac0a Mon Sep 17 00:00:00 2001 From: Claromes Date: Mon, 29 May 2023 01:47:51 -0300 Subject: [PATCH 1/3] add article.list --- fivbvis/article.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fivbvis/article.py b/fivbvis/article.py index a385b42..1d50dfa 100644 --- a/fivbvis/article.py +++ b/fivbvis/article.py @@ -10,4 +10,11 @@ def get(self, no, fields=''): response = requests.get(url, headers=self.headers) + return response.json() + + def list(self, fields, filter='', tags=''): + url = self.base_url + "'{}'{}".format(fields, filter, tags) + + response = requests.get(url, headers=self.headers) + return response.json() \ No newline at end of file From 25846290f82c773e56d3635e3759b92f6249ebbe Mon Sep 17 00:00:00 2001 From: Claromes Date: Mon, 29 May 2023 02:40:08 -0300 Subject: [PATCH 2/3] update readme and docs --- README.md | 186 ++++++++++++++++++++----------- docs/DOCS.md | 107 ------------------ docs/index.md | 295 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 420 insertions(+), 168 deletions(-) delete mode 100644 docs/DOCS.md create mode 100644 docs/index.md diff --git a/README.md b/README.md index 9dd1ae8..2eaddca 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # FIVB VIS Python Client -![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/claromes/fivbvis?include_prereleases) -![GitHub](https://img.shields.io/github/license/claromes/fivbvis) +![PyPI](https://img.shields.io/pypi/v/fivbvis) -Python client library to easily integrate with FIVB VIS Web Service public data. +Python client library to easily integrate with [FIVB VIS Web Service](https://www.fivb.org/VisSDK/VisWebService/#Introduction.html) public data. Responses are formatted using JSON. @@ -16,30 +15,139 @@ pip3 install fivbvis ```python from fivbvis import VolleyMatch -vb = VolleyMatch() +vm = VolleyMatch() -print(vb.match(9211)) +print(vm.match(9211)) ``` ```json { "data":{ - "assistantScorerCountryCode":"None", - "assistantScorerFirstName":"None", - "assistantScorerLastName":"None", - "beginDateTimeUtc":"2018-10-07T04:25:00Z", - "buyTicketsUrl":"", - "city":"Nagoya", - "countryCode":"JP", - "countryName":"Japan", - "dateLocal":"2018-10-07", - ... + "assistantScorerCountryCode":"None", + "assistantScorerFirstName":"None", + "assistantScorerLastName":"None", + "beginDateTimeUtc":"2018-10-07T04:25:00Z", + "buyTicketsUrl":"", + "city":"Nagoya", + "countryCode":"JP", + "countryName":"Japan", + "dateLocal":"2018-10-07", + "dateTimeLocal":"2018-10-07T13:25:00", + "dateTimeUtc":"2018-10-07T04:25:00Z", + "durationSet1":1320, + "durationSet2":1560, + "durationSet3":2520, + "durationSet4":1680, + "durationSet5":1080, + "durationSet6":"None", + "durationSet7":"None", + "durationTotal":8160, + "endDateTimeUtc":"2018-10-07T06:53:00Z", + "endTime":"15:53:00", + "format":1, + "fullDuration":8880, + "hall":"Nippongaishi Hall", + "hasLiveData":1, + "isFreeEntrance":0, + "isVtsAvailable":0, + "lineJudge1CountryCode":"None", + "lineJudge1FirstName":"None", + "lineJudge1LastName":"None", + "lineJudge2CountryCode":"None", + "lineJudge2FirstName":"None", + "lineJudge2LastName":"None", + "lineJudge3CountryCode":"None", + "lineJudge3FirstName":"None", + "lineJudge3LastName":"None", + "lineJudge4CountryCode":"None", + "lineJudge4FirstName":"", + "lineJudge4LastName":"None", + "liveScoreFromScoresheet":1, + "liveStreamUri":"https://welcome.volleyballworld.tv/", + "loserRank":0, + "matchPointsA":3, + "matchPointsB":2, + "matchResultText":"3-2", + "nbSets":5, + "nbSpectators":3000, + "no":9211, + "noConfederation":"None", + "noDocumentP2":256122695, + "noEvent":658, + "noInTournament":63, + "noPool":2421, + "noPoolRound":130, + "noReferee1":150966, + "noReferee2":153275, + "noReferee3":"None", + "noRefereeChallenge":150773, + "noRefereeReserve":151023, + "noTeamA":3675, + "noTeamB":3694, + "noTournament":1029, + "pointsTeamASet1":14, + "pointsTeamASet2":19, + "pointsTeamASet3":32, + "pointsTeamASet4":25, + "pointsTeamASet5":17, + "pointsTeamASet6":"None", + "pointsTeamASet7":"None", + "pointsTeamBSet1":25, + "pointsTeamBSet2":25, + "pointsTeamBSet3":30, + "pointsTeamBSet4":19, + "pointsTeamBSet5":15, + "pointsTeamBSet6":"None", + "pointsTeamBSet7":"None", + "poolCode":"E", + "poolName":"Pool E", + "poolOrder":5, + "poolRoundCode":"II", + "poolRoundName":"Second round", + "referee1FederationCode":"KOR", + "referee1Name":"Kang Joo-Hee", + "referee2FederationCode":"ITA", + "referee2Name":"Rapisarda Daniele", + "resultType":0, + "resultTypeText":"None", + "scheduleInfo":4, + "scorerCountryCode":"None", + "scorerFirstName":"None", + "scorerLastName":"None", + "season":"2018", + "setsResultsText":"(14-25, 19-25, 32-30, 25-19, 17-15)", + "status":25, + "statusText":"Result is official", + "teamACalculatedCode":"GER", + "teamACalculatedName":"Germany", + "teamACode":"GER", + "teamALiberoUniformColor":"Red", + "teamAName":"Germany", + "teamAShirtColor":"Black", + "teamAText":"GER", + "teamBCalculatedCode":"BRA", + "teamBCalculatedName":"Brazil", + "teamBCode":"BRA", + "teamBLiberoUniformColor":"Blue", + "teamBName":"Brazil", + "teamBShirtColor":"Yellow", + "teamBText":"BRA", + "teamCodeA":"GER", + "teamCodeB":"BRA", + "teamNameA":"Germany", + "teamNameB":"Brazil", + "timeLocal":"13:25:00", + "tournamentCode":"WWCH2018", + "winnerRank":0 } } ``` -## Docs +## [Documentation](https://claromes.github.io/fivbvis) -[Objects documentation](docs/DOCS.md) +## Requests Available + +- Article +- VolleyMatch ## Development @@ -48,47 +156,3 @@ $ `git clone git@github.com:claromes/fivbvis.git` $ `cd fivbvis` $ `pip3 install -r dev-requirements.txt` - -## Requests - -- [x] Article Object - -- [ ] Beach Object - -- [ ] Confederation Object - -- [ ] Federation Object - -- [ ] Image Object - -- [ ] Match Object - -- [ ] Phase Object - -- [ ] Player Object - -- [ ] Round Object - -- [ ] Tournament Object - -- [ ] VolleyClub Object - -- [ ] VolleyLive Object - -- [x] VolleyMatch Object - -- [ ] VolleyPlayer Object - -- [ ] VolleyPool Object - -- [ ] VolleyRankingDefinition Object - -- [ ] VolleyStatistic Object - -- [ ] VolleyTeam Object - -- [ ] VolleyTournament Object - -- [ ] VolleyTransfer Object - -[VIS Web Service Requests full list](https://www.fivb.org/VisSDK/VisWebService/RequestList.html) diff --git a/docs/DOCS.md b/docs/DOCS.md deleted file mode 100644 index 2661b4a..0000000 --- a/docs/DOCS.md +++ /dev/null @@ -1,107 +0,0 @@ -# Documentation - -## Article Object ----- - -`class` fivbvis.Article() - ->get(no, fields='') - -Get a article. - -- Parameters: - - `no` (int) - The number of the match. - - `fields` (str) - All the fields in the article data. Must be space-separated. [(Fields/Properties list of each article)](https://www.fivb.org/VisSDK/VisWebService/Article.html) - -- Request example: - - `get(28639, 'No')` - -- Return type: dict - -## Beach Object ----- - -## Confederation Object ----- - -## Federation Object ----- - -## Image Object ----- - -## Match Object ----- - -## Phase Object ----- - -## Player Object ----- - -## Round Object ----- - -## Tournament Object ----- - -## VolleyClub Object ----- - -## VolleyLive Object ----- - -## VolleyMatch Object ----- - -`class` fivbvis.VolleyMatch() - ->match(no) - -Get a volleyball match. - -- Parameters: - - `no` (int) - The number of the match. - -- Request example: - - `match(9211)` - -- Return type: dict - ->list(no_tournament, fields='', filter='') - -Get a list of volleyball matches. - -- Parameters: - - `no_tournament` (int) - The number of the tournament. - - `fields` (str) - All the fields in the volleyball match data. Must be space-separated. [(Fields/Properties list of each match)](https://www.fivb.org/VisSDK/VisWebService/#VolleyMatch.html) - - `filter` (str, (optional)) - All the filters in the volleyball match data. Must be space-separated. [(Filter list of each match)](https://www.fivb.org/VisSDK/VisWebService/VolleyMatchFilter.html) - -- Request example: - - `list(979, 'City Hall MatchPointsA MatchPointsB', 'FirstDate="2017-07-01" LastDate="2017-07-31"')` - -- Return type: dict - -## VolleyPlayer Object ----- - -## VolleyPool Object ----- - -## VolleyRankingDefinition Object ----- - -## VolleyStatistic Object ----- - -## VolleyTeam Object ----- - -## VolleyTournament Object ----- - -## VolleyTransfer Object ----- diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..d87aa91 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,295 @@ +# FIVB VIS Python Client + +![PyPI](https://img.shields.io/pypi/v/fivbvis) + +Python client library to easily integrate with [FIVB VIS Web Service](https://www.fivb.org/VisSDK/VisWebService/#Introduction.html) public data. + +Responses are formatted using JSON. + +
+ +# Docs + +## Installation + +```shell +pip3 install fivbvis +``` + +
+ +## Usage +```python +from fivbvis import VolleyMatch + +vm = VolleyMatch() + +print(vm.match(9211)) +``` +```json +{ + "data":{ + "assistantScorerCountryCode":"None", + "assistantScorerFirstName":"None", + "assistantScorerLastName":"None", + "beginDateTimeUtc":"2018-10-07T04:25:00Z", + "buyTicketsUrl":"", + "city":"Nagoya", + "countryCode":"JP", + "countryName":"Japan", + "dateLocal":"2018-10-07", + "dateTimeLocal":"2018-10-07T13:25:00", + "dateTimeUtc":"2018-10-07T04:25:00Z", + "durationSet1":1320, + "durationSet2":1560, + "durationSet3":2520, + "durationSet4":1680, + "durationSet5":1080, + "durationSet6":"None", + "durationSet7":"None", + "durationTotal":8160, + "endDateTimeUtc":"2018-10-07T06:53:00Z", + "endTime":"15:53:00", + "format":1, + "fullDuration":8880, + "hall":"Nippongaishi Hall", + "hasLiveData":1, + "isFreeEntrance":0, + "isVtsAvailable":0, + "lineJudge1CountryCode":"None", + "lineJudge1FirstName":"None", + "lineJudge1LastName":"None", + "lineJudge2CountryCode":"None", + "lineJudge2FirstName":"None", + "lineJudge2LastName":"None", + "lineJudge3CountryCode":"None", + "lineJudge3FirstName":"None", + "lineJudge3LastName":"None", + "lineJudge4CountryCode":"None", + "lineJudge4FirstName":"", + "lineJudge4LastName":"None", + "liveScoreFromScoresheet":1, + "liveStreamUri":"https://welcome.volleyballworld.tv/", + "loserRank":0, + "matchPointsA":3, + "matchPointsB":2, + "matchResultText":"3-2", + "nbSets":5, + "nbSpectators":3000, + "no":9211, + "noConfederation":"None", + "noDocumentP2":256122695, + "noEvent":658, + "noInTournament":63, + "noPool":2421, + "noPoolRound":130, + "noReferee1":150966, + "noReferee2":153275, + "noReferee3":"None", + "noRefereeChallenge":150773, + "noRefereeReserve":151023, + "noTeamA":3675, + "noTeamB":3694, + "noTournament":1029, + "pointsTeamASet1":14, + "pointsTeamASet2":19, + "pointsTeamASet3":32, + "pointsTeamASet4":25, + "pointsTeamASet5":17, + "pointsTeamASet6":"None", + "pointsTeamASet7":"None", + "pointsTeamBSet1":25, + "pointsTeamBSet2":25, + "pointsTeamBSet3":30, + "pointsTeamBSet4":19, + "pointsTeamBSet5":15, + "pointsTeamBSet6":"None", + "pointsTeamBSet7":"None", + "poolCode":"E", + "poolName":"Pool E", + "poolOrder":5, + "poolRoundCode":"II", + "poolRoundName":"Second round", + "referee1FederationCode":"KOR", + "referee1Name":"Kang Joo-Hee", + "referee2FederationCode":"ITA", + "referee2Name":"Rapisarda Daniele", + "resultType":0, + "resultTypeText":"None", + "scheduleInfo":4, + "scorerCountryCode":"None", + "scorerFirstName":"None", + "scorerLastName":"None", + "season":"2018", + "setsResultsText":"(14-25, 19-25, 32-30, 25-19, 17-15)", + "status":25, + "statusText":"Result is official", + "teamACalculatedCode":"GER", + "teamACalculatedName":"Germany", + "teamACode":"GER", + "teamALiberoUniformColor":"Red", + "teamAName":"Germany", + "teamAShirtColor":"Black", + "teamAText":"GER", + "teamBCalculatedCode":"BRA", + "teamBCalculatedName":"Brazil", + "teamBCode":"BRA", + "teamBLiberoUniformColor":"Blue", + "teamBName":"Brazil", + "teamBShirtColor":"Yellow", + "teamBText":"BRA", + "teamCodeA":"GER", + "teamCodeB":"BRA", + "teamNameA":"Germany", + "teamNameB":"Brazil", + "timeLocal":"13:25:00", + "tournamentCode":"WWCH2018", + "winnerRank":0 + } +} +``` + +
+ +## Requests + +### Article +---- + +`class` fivbvis.Article() + +>get(no, fields='') + +Get a article. + +- Parameters: + - `no` (int) - The number of the match. + - `fields` (str) - All the fields in the article data. Must be space-separated. [(Fields/Properties list of each article)](https://www.fivb.org/VisSDK/VisWebService/Article.html) + +- Request example: + + ```python + from fivbvis import Article + + a = Article() + print(a.get(28639, 'No source isVideoLive')) + ``` + +- Return type: dict + +>list(fields, filter='', tags='') + +Get a list of article. + +- Parameters: + - `fields` (str) - All the fields in the article data. Must be space-separated. [(Fields/Properties list of each article)](https://www.fivb.org/VisSDK/VisWebService/Article.html) + - `filter` (str) - Where the articles were published. Must be space-separated. [(Filter for an article)](https://www.fivb.org/VisSDK/VisWebService/ArticleFilter.html) + - `tags` (str) - Tags in the article data. Must be space-separated. [(Tags Filtering examples)](https://www.fivb.org/VisSDK/VisWebService/TagFiltering.html) + +- Request example: + + ```python + from fivbvis import Article + + a = Article() + print(a.list('No PhotoUrl PublishOnFivb ShareUrl', 'Home', 'volley-tournament:979')) + ``` + +- Return type: `dict` + +
+ +### Beach +---- + +### Confederation +---- + +### Federation +---- + +### Image +---- + +### Match +---- + +### Phase +---- + +### Player +---- + +### Round +---- + +### Tournament +---- + +### VolleyClub +---- + +### VolleyLive +---- + +
+ +### VolleyMatch +---- + +`class` fivbvis.VolleyMatch() + +>match(no) + +Get a volleyball match. + +- Parameters: + - `no` (int) - The number of the match. + +- Request example: + + `match(9211)` + +- Return type: dict + +>list(no_tournament, fields='', filter='') + +Get a list of volleyball matches. + +- Parameters: + - `no_tournament` (int) - The number of the tournament. + - `fields` (str) - All the fields in the volleyball match data. Must be space-separated. [(Fields/Properties list of each match)](https://www.fivb.org/VisSDK/VisWebService/#VolleyMatch.html) + - `filter` (str, (optional)) - All the filters in the volleyball match data. Must be space-separated. [(Filter list of each match)](https://www.fivb.org/VisSDK/VisWebService/VolleyMatchFilter.html) + +- Request example: + + `list(979, 'City Hall MatchPointsA MatchPointsB', 'FirstDate="2017-07-01" LastDate="2017-07-31"')` + +- Return type: dict + +
+ +### VolleyPlayer +---- + +### VolleyPool +---- + +### VolleyRankingDefinition +---- + +### VolleyStatistic +---- + +### VolleyTeam +---- + +### VolleyTournament +---- + +### VolleyTransfer +---- + +
+ +[VIS Web Service Requests full list](https://www.fivb.org/VisSDK/VisWebService/RequestList.html) From d7a35f0aee1cc761982e297079e2881d02c335a0 Mon Sep 17 00:00:00 2001 From: Claromes Date: Mon, 29 May 2023 03:13:24 -0300 Subject: [PATCH 3/3] update setup and check coverage --- .gitignore | 2 ++ dev-requirements.txt | 1 + docs/index.md | 2 +- fivbvis/version.py | 2 +- setup.py | 5 ++++- 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 8160bb0..9cdb3d1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ fivbvis/__pycache__/ tests/__pycache__/ tests/vcr_cassettes/ +tests/tests/ +tests/.coverage example.py request.txt diff --git a/dev-requirements.txt b/dev-requirements.txt index b5451a2..021d23c 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,5 @@ -r requirements.txt pytest==7.2.0 +pytest-cov==4.1.0 vcrpy==4.2.1 \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index d87aa91..56e85fb 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,6 +1,6 @@ # FIVB VIS Python Client -![PyPI](https://img.shields.io/pypi/v/fivbvis) +![PyPI](https://img.shields.io/pypi/v/fivbvis) ![GitHub](https://img.shields.io/github/license/claromes/fivbvis) Python client library to easily integrate with [FIVB VIS Web Service](https://www.fivb.org/VisSDK/VisWebService/#Introduction.html) public data. diff --git a/fivbvis/version.py b/fivbvis/version.py index 34da6b8..ef0b380 100644 --- a/fivbvis/version.py +++ b/fivbvis/version.py @@ -1 +1 @@ -__version__ = '0.1.2' \ No newline at end of file +__version__ = '0.1.3' \ No newline at end of file diff --git a/setup.py b/setup.py index 8576809..5dc968d 100644 --- a/setup.py +++ b/setup.py @@ -15,12 +15,15 @@ name='fivbvis', version=version, author='claromes', - license='GPLv3', description='FIVB VIS Web Service Python Client', long_description=long_description, long_description_content_type='text/markdown', keywords='api-wrapper fivbvis fivb volleyball beachvolleyball', url='https://github.com/claromes/fivbvis', + project_urls={ + 'Documentation': 'https://claromes.github.io/fivbvis/', + 'Issue Tracker': 'https://github.com/claromes/fivbvis/issues', + }, packages=find_packages(exclude=['docs', 'tests*']), classifiers=[ 'Development Status :: 3 - Alpha',