MCPcopy
hub / github.com/InstaPy/InstaPy / quota_supervisor

Function quota_supervisor

instapy/quota_supervisor.py:17–42  ·  view source on GitHub ↗

Supervise activity flow through action engines and take measures

(job, update=False)

Source from the content-addressed store, hash-verified

15
16
17def quota_supervisor(job, update=False):
18 """Supervise activity flow through action engines and take measures"""
19 # --ACTION----------ENGINE--------------FILE--------------OPTION--- #
20 # Like `like_image` [like_util.py] jump|sleep #
21 # Comment `comment_image` [comment_util.py] jump|sleep #
22 # Follow `follow_user` [unfollow_util.py] jump|sleep #
23 # Unfollow `unfollow_user` [unfollow_util.py] jump|sleep #
24 # *Server call `update_activity` [util.py] exit|sleep #
25 # ----------------------------------------------------------------- #
26
27 global configuration
28 configuration = Settings.QS_config
29
30 if configuration and configuration["state"] is True:
31 # in-file global variables for the QS family
32 global records, logger, this_minute, this_hour, today
33
34 records = Storage.record_activity
35 logger = Settings.logger
36 this_minute, this_hour, today = get_time(["this_minute", "this_hour", "today"])
37 if update: # update the action's record in global storage
38 update_record(job)
39
40 else: # inspect and control the action's availability
41 quota_state = controller(job)
42 return quota_state
43
44
45def controller(job):

Callers 5

follow_userFunction · 0.90
unfollow_userFunction · 0.90
comment_imageFunction · 0.90
update_activityFunction · 0.90
like_imageFunction · 0.90

Calls 3

get_timeFunction · 0.85
update_recordFunction · 0.85
controllerFunction · 0.85

Tested by

no test coverage detected