Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/euanwm/iwf-api
API for iwf.sport in Python
https://github.com/euanwm/iwf-api
Last synced: 3 days ago
JSON representation
API for iwf.sport in Python
- Host: GitHub
- URL: https://github.com/euanwm/iwf-api
- Owner: euanwm
- License: mit
- Fork: true (jwc20/iwf_api)
- Created: 2022-08-05T19:41:31.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-24T20:24:49.000Z (8 months ago)
- Last Synced: 2024-04-17T22:04:28.219Z (6 months ago)
- Language: Python
- Homepage:
- Size: 128 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# iwf-api
A pip library to scrape filtered events and results from the IWF (International Weightlifting Federation) website.
### Methods:
- `get_years()`
- `get_events(search_url, year, new_or_old, nation, event_type, age_group)`
- `get_result(search_url)`### Usage:
To import, type:
```
import iwf
```To search events, type:
```
search_keywords = []
client = iwf.Iwf(search_keywords)for event in client.get_events():
print(event)
print(event['name'])
```or
```
print(client.get_events(year='2018', new_or_old="new", age_group='Youth'))
```to get the following results:
```
[{
'name': '5th International Qatar Cup',
'result_url': '?event_id=444',
'location': 'QAT',
'date': 'Dec 19, 2018'
}, {
'name': '5th International Solidarity Championships',
'result_url': '?event_id=445',
'location': 'EGY',
'date': 'Dec 08, 2018'
}, {
'name': 'II International Senior CSLP Cup',
'result_url': '?event_id=442',
'location': 'ECU',
'date': 'Dec 07, 2018'
}, {
'name': 'II International Junior CSLP Cup',
'result_url': '?event_id=443',
'location': 'ECU',
'date': 'Dec 07, 2018'
}, {
'name': '2018 IWF World Championships',
'result_url': '?event_id=441',
'location': 'TKM',
'date': 'Nov 01, 2018'
}]
```To get results for an event, use the following method with an url:
```
url = "https://iwf.sport/results/results-by-events/?event_id=486"
result = client.get_results(search_url=url)
print(result)
```and you will get:
```
[{'birthdate': 'Apr 02, 2003',
'bodyweight': '48.88',
'category': '49',
'gender': 'Men',
'group': 'A',
'jerk': '121',
'jerk1': '115',
'jerk2': '121',
'jerk3': 126,
'name': 'PAK Myong Jin',
'nation': 'PRK',
'rank': '1',
'rank_cj': '1',
'rank_sn': '1',
'snatch': '100',
'snatch1': '90',
'snatch2': '96',
'snatch3': '100',
'total': '221'},
...
```### Scraped Data:
#### Event:
- name
- location
- date
- url#### Result:
- name
- nation
- birthdate
- bodyweight
- category_number
- gender
- group
- snatch1
- snatch2
- snatch3
- snatch
- rank_sn
- jerk1
- jerk2
- jerk3
- jerk
- rank_cj
- total
- rank### Installation:
To install, pip install into python virtual environment.
```
pip install -i https://test.pypi.org/simple/ iwf-api-jwc20
```### Requirements:
Make sure to install the requirements before running the app.
- beautifulsoup4
- lxml
- requests