This repository has been archived by the owner on Aug 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from quintindunn/development
Added Searching functions
- Loading branch information
Showing
10 changed files
with
140 additions
and
5 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
examples/get_profile_by_username/get_profile_by_username_01.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import os | ||
|
||
from lapsepy.lapse import Lapse | ||
|
||
if __name__ == '__main__': | ||
lapse = Lapse(os.getenv("REFRESH_TOKEN")) | ||
|
||
username = input("Username: ") | ||
|
||
profile = lapse.get_profile_by_username(username, friends_limit=1) | ||
|
||
print(profile.username, profile.user_display_name) | ||
|
||
im = profile.load_profile_picture() | ||
im.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import os | ||
|
||
from lapsepy import Lapse | ||
|
||
if __name__ == '__main__': | ||
lapse = Lapse(os.getenv("REFRESH_TOKEN")) | ||
|
||
user = input("User: ") | ||
result = lapse.search_for_user(user, first=1) | ||
print(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from lapsepy.lapse import Lapse | ||
|
||
|
||
class SearchUser: | ||
def __init__(self, user_id, display_name: str, profile_photo_name: str, username: str, friend_status: str, | ||
blocked_me: bool, is_blocked: bool): | ||
|
||
self.user_id = user_id | ||
self.display_name = display_name, | ||
self.profile_photo_name = profile_photo_name | ||
self.username = username | ||
self.friend_status = friend_status | ||
self.blocked_me = blocked_me | ||
self.is_blocked = is_blocked | ||
|
||
def to_profile(self, ctx: "Lapse", album_limit: int = 6, friends_limit: int = 10): | ||
return ctx.get_profile_by_id(user_id=self.user_id, album_limit=album_limit, friends_limit=friends_limit) | ||
|
||
def __str__(self): | ||
return f"<SearchUser username=\"{self.username}\" user_id=\"{self.user_id}\">" | ||
|
||
__repr__ = __str__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters