Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 137 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,143 @@ with open(data.filename, 'wb') as f:
f.writelines(data.content)
```

### Kudos of activity
Get a list of athletes who kudoed a given activity.
The returned data is more detailed information about the athlete in comparison with the API call.

```python
from stravaweblib import WebClient

# Log in (requires API token and email/password for the site)
client = WebClient(access_token=OAUTH_TOKEN, email=EMAIL, password=PASSWORD)

# Get the id of the first activity of the current athlete
activities = client.get_activities()
activity_id = activities.next().id

# Get kudos data for activity of the current athlete
my_activity_kudos_data = client.get_activity_kudos(activity_id=activity_id)

# Get kudos data for other activities, it means we can retrieve kudos data of any activity
activity_id = 12345678
other_activity_kudos_data = client.get_activity_kudos(activity_id=activity_id)

```

### Mentionable entities
Get a list of mentionable entities.
The returned data is a list of athletes and clubs that the current athlete is following.

```python
from stravaweblib import WebClient

# Log in (requires API token and email/password for the site)
client = WebClient(access_token=OAUTH_TOKEN, email=EMAIL, password=PASSWORD)

# Get all mentionable entities of the current athlete
mentionable_entities = client.get_mentionable_entities()
```

### Give kudos
Give kudos for a given activity.

```python
from stravaweblib import WebClient

# Log in (requires API token and email/password for the site)
client = WebClient(access_token=OAUTH_TOKEN, email=EMAIL, password=PASSWORD)

# Give kudos
activity_id = 12345678
client.give_kudos(activity_id=activity_id)
```

### Post comment
Post a comment for a given activity.

```python
from stravaweblib import WebClient

# Log in (requires API token and email/password for the site)
client = WebClient(access_token=OAUTH_TOKEN, email=EMAIL, password=PASSWORD)

# Post comment. Also, it is possible to mention somebody or any club
activity_id = 12345678
mentionable_athlete_ids = [12345, 12354] # optional
mentionable_club_ids = [1234] # optional
comment = "Wow, awesome result!"
client.post_comment(activity_id=activity_id,
mentionable_athlete_ids=mentionable_athlete_ids,
mentionable_club_ids=mentionable_club_ids,
comment=comment)
```
Example of the comment: **AthleteName1** **AthleteName2** **ClubName** Wow, awesome result!

### Like, unlike comment
Give or remove a like for a given comment.

```python
from stravaweblib import WebClient

# Log in (requires API token and email/password for the site)
client = WebClient(access_token=OAUTH_TOKEN, email=EMAIL, password=PASSWORD)

# Like comment
comment_id = 12345678
client.like_comment(comment_id=comment_id)

# Unlike comment
client.unlike_comment(comment_id=comment_id)
```

### Get feed entries
Return a list of feed entries.

```python
from stravaweblib import WebClient

# Log in (requires API token and email/password for the site)
client = WebClient(access_token=OAUTH_TOKEN, email=EMAIL, password=PASSWORD)

# Return a list of My Activity feed entries.
my_activity_feed_entries = client.get_my_activity_feed()

# Return a list of the Following feed entries.
following_feed_entries = client.get_following_feed()

# Return a list of the given Club feed entries.
club_id=1234
club_feed_entries = client.get_club_feed(club_id=club_id)
```

### Parse athlete profile following tab
Return a list of athletes.

```python
from stravaweblib import WebClient

# Log in (requires API token and email/password for the site)
client = WebClient(access_token=OAUTH_TOKEN, email=EMAIL, password=PASSWORD)

# Return a list of followers athletes of the authorised athlete or given athlete_id
my_followers = client.get_followers_athletes()

athlete_id=1234567
athlete_followers = client.get_followers_athletes(athlete_id=athlete_id)

# Return a list of following athletes of the authorised athlete or given athlete_id
my_following = client.get_following_athletes()

athlete_id=1234567
athlete_following = client.get_following_athletes(athlete_id=athlete_id)

# Return a list of suggested athletes of the authorised athlete.
suggested_athletes = client.get_suggested_athletes()

# Return a list of both following athletes. Both - it means the current and other athlete are following.
athlete_id=1234567
both_following_athletes = client.get_both_following_athletes(athlete_id=athlete_id)
```

License
=======
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

setup(
name="stravaweblib",
version="0.0.8",
version="0.0.9",
description="Extends the Strava v3 API using web scraping",
long_description=long_description,
long_description_content_type="text/markdown",
Expand All @@ -37,7 +37,7 @@
packages=["stravaweblib"],
python_requires=">=3.4.0",
install_requires=[
"stravalib>=0.6.6,<1.0.0",
"stravalib>=0.6.6,<2.0.0",
"beautifulsoup4>=4.6.0,<5.0.0",
],
)
38 changes: 38 additions & 0 deletions stravaweblib/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from typing import List

from pydantic import BaseModel, Field


class Athlete(BaseModel):
avatar_url: str
firstname: str
id: int
is_following: bool
is_private: bool
location: str
member_type: str
name: str
url: str


class Kudos(BaseModel):
athletes: List[Athlete] = Field(default_factory=list)
is_owner: bool
kudosable: bool


class MentionableAthlete(BaseModel):
display: str
id: str
location: str
member_type: str
profile: str
type: str


class MentionableClub(BaseModel):
display: str
id: str
image: str
location: str
type: str
Loading