fishbowlpy package#

Subpackages#

Submodules#

fishbowlpy.browserdriver module#

class fishbowlpy.browserdriver.BrowserDriver(driver_type=DriverType.CHROME_DRIVER, driver_path: str = None)#

Bases: object

get_default_driver(driver_type: int) ChromiumDriver#
get_driver() ChromiumDriver#

fishbowlpy.config module#

fishbowlpy.drivertype module#

class fishbowlpy.drivertype.DriverType(*values)#

Bases: Enum

CHROME_DRIVER = 1#
EDGE_DRIVER = 2#
FIREFOX_DRIVER = 3#
IE_DRIVER = 4#
OPERA_DRIVER = 6#
SAFARI_DRIVER = 5#

fishbowlpy.filedownloader module#

fishbowlpy.filedownloader.download_file(url, filepath)#

fishbowlpy.fishbowlapi module#

class fishbowlpy.fishbowlapi.FishBowlAPI(session_key: str)#

Bases: object

get_bowl_details(bowl_name)#
get_post_comments(post_id: str, sort: str = 'byDate', start: int = 0, count: int = 20, **kwargs)#

Get comments for a specific post.

Parameters:
  • post_id -- The ID of the post to fetch comments for

  • sort -- Sort order for comments (default: 'byDate', options: 'byDate', 'byPopularity')

  • start -- Starting index for pagination (default: 0)

  • count -- Number of comments to return (default: 20, max: 100)

  • **kwargs --

    Additional query parameters

Returns:

Comments data in JSON format

Basic Usage: >>> api = FishBowlAPI(session_key='your_key') >>> comments = api.get_post_comments(post_id='12345') >>> comments = api.get_post_comments(post_id='12345', count=50, sort='byPopularity')

get_posts(bowl_name: str, sort: str = None, start: int = None, count: int = None)#
get_posts_by_bowl_id(bowl_id, sort: str = None, start: int = None, count: int = None)#

fishbowlpy.fishbowlclient module#

class fishbowlpy.fishbowlclient.FishBowlClient(**kwargs)#

Bases: object

This class is used to interact with the FishBowlApp. This class provides the interface with the ability to configure the required configuration like driver paths, session key etc.

Parameters:
  • login_manager(FishBowlLoginManager) -- An instance of the FishBowlLoginManager class.

  • fishbowl_api(FishBowlAPI) -- An instance of the FishBowlAPI class.

  • driver_type(DriverType) -- An instance of the DriverType class.

  • **kwargs --

    Any other keyword arguments.

Returns:

None

Basic Usage: >>> from fishbowlpy.fishbowlclient import FishBowlClient >>> client = FishBowlClient() >>> client.get_bowls_names() >>> client.get_posts(bowl_name='fishbowl')

Copyright:
  1. 2024 MIT Licensed

get_bowls_names()#

This is a placeholder method that will be used to get the names of the subscribed bowls

get_post_comments(post_id: str, **kwargs)#

This method returns the comments for a given post_id in json format.

Parameters:
  • post_id -- Post ID from where to get the comments.

  • sort -- Sort order for comments (default: 'byDate', options: 'byDate', 'byPopularity')

  • start -- Starting index for pagination (default: 0)

  • count -- Number of comments to return (default: 20)

  • **kwargs --

    Additional parameters for flexible configuration

Returns:

Comments in json format.

Basic Usage: >>> from fishbowlpy.fishbowlclient import FishBowlClient >>> client = FishBowlClient() >>> comments = client.get_post_comments(post_id='12345') >>> comments = client.get_post_comments(post_id='12345', count=50, sort='byPopularity')

get_posts(bowl_name: str)#

This method returns the posts in the bowl_name in json format.

Parameters:

bowl_name -- Bowl name from where to get the posts.

Returns:

Posts in json format.

refresh_session()#

This is a placeholder method that will be used to refresh the session

fishbowlpy.fishbowldatatypes module#

class fishbowlpy.fishbowldatatypes.FishBowlResponse#

Bases: object

data = None#
headers = None#

fishbowlpy.fishbowlloginmanager module#

class fishbowlpy.fishbowlloginmanager.FishBowlLoginManager(session_key: str = None, session_expiry: float = None, login_popup: bool = True, driver_type: str = DriverType.CHROME_DRIVER, driver_path: str = None)#

Bases: object

get_session_key() str#

Returns the session key

Returns:

str: Session key for current session

load_session(file='D:\\Workspace\\fishbowlpy\\source\\..\\src\\fishbowlpy\\tmp\\session\\session_data.json') bool#
login(driver_type: str = DriverType.CHROME_DRIVER, driver_path: str = None)#

Fishbowl client logs in by either reading previous session or by manually logging in.

Args:

driver_type (str, optional): Provide the driver type. Defaults to DriverType.CHROME_DRIVER.

save_session_data()#

Saves the session data into a json file for future login attempts

set_session_key(session_key=None, session_expiry=None)#

Sets the session key and session expiry

Args:

session_key (str, optional): The session key from cookie. Defaults to None. session_expiry (int, optional): The epoch time when session expires. Defaults to None.

fishbowlpy.urlmanager module#

class fishbowlpy.urlmanager.FishbowlURLManager#

Bases: object

get_bowl_details_url(bowl_name)#
get_cert_path()#
get_comments_url(post_id, sort='byDate', start=0, count=20)#

Construct URL for fetching comments of a specific post.

Parameters:
  • post_id -- The ID of the post

  • sort -- Sort order for comments (default: 'byDate')

  • start -- Starting index for pagination (default: 0)

  • count -- Number of comments to fetch (default: 20)

Returns:

Complete URL for comments API endpoint

get_headers(session_key)#
get_posts_url(bowl_id, sort: str = 'byDate', start: int = 0, count: int = 20)#

Module contents#