MCPcopy
hub / github.com/InstaPy/InstaPy / verify_commenting

Function verify_commenting

instapy/comment_util.py:152–180  ·  view source on GitHub ↗

Get the amount of existing existing comments and compare it against maximum & minimum values defined by user

(browser, maximum, minimum, logger)

Source from the content-addressed store, hash-verified

150
151
152def verify_commenting(browser, maximum, minimum, logger):
153 """
154 Get the amount of existing existing comments and
155 compare it against maximum & minimum values defined by user
156 """
157
158 commenting_state, msg = is_commenting_enabled(browser, logger)
159 if commenting_state is not True:
160 disapproval_reason = "--> Not commenting! {}".format(msg)
161 return False, disapproval_reason
162
163 comments_count, msg = get_comments_count(browser, logger)
164 if comments_count is None:
165 disapproval_reason = "--> Not commenting! {}".format(msg)
166 return False, disapproval_reason
167
168 if maximum is not None and comments_count > maximum:
169 disapproval_reason = "Not commented on this post! ~more comments exist off maximum limit at {}".format(
170 comments_count
171 )
172 return False, disapproval_reason
173
174 elif minimum is not None and comments_count < minimum:
175 disapproval_reason = "Not commented on this post! ~less comments exist off minimum limit at {}".format(
176 comments_count
177 )
178 return False, disapproval_reason
179
180 return True, "Approval"
181
182
183def verify_mandatory_words(

Callers 2

get_comments_on_postFunction · 0.85
process_commentsFunction · 0.85

Calls 2

is_commenting_enabledFunction · 0.85
get_comments_countFunction · 0.85

Tested by

no test coverage detected