Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Add switch to force MassPay postback
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Feb 17, 2017
1 parent 9161884 commit e5fd92b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bin/masspay.py
Expand Up @@ -181,7 +181,7 @@ def load_statuses():
return statuses


def post_back_to_gratipay():
def post_back_to_gratipay(force=False):

try:
gratipay_api_key = os.environ['GRATIPAY_API_KEY']
Expand All @@ -194,8 +194,9 @@ def post_back_to_gratipay():
gratipay_base_url = 'https://gratipay.com'

nmasspays = int(requests.get(gratipay_base_url + '/dashboard/nmasspays').text())
if nmasspays < 10:
print("It looks like we didn't run MassPay last week! Bailing ...")
if nmasspays < 10 and not force:
print("It looks like we didn't run MassPay last week! If you are absolutely sure that we "
"did, then rerun with -f.")
return

statuses = load_statuses()
Expand Down Expand Up @@ -271,7 +272,7 @@ def main():
elif '-o' in sys.argv:
compute_output_csvs()
elif '-p' in sys.argv:
post_back_to_gratipay()
post_back_to_gratipay('-f' in sys.argv)


if __name__ == '__main__':
Expand Down

0 comments on commit e5fd92b

Please sign in to comment.