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

Commit

Permalink
Make the masspay script a little more flexible
Browse files Browse the repository at this point in the history
Take the Gittip instance URL from config to enable the possibility of
testing.
  • Loading branch information
chadwhitacre committed Oct 11, 2013
1 parent 5a6ef86 commit 379409d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion masspay.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,13 @@ def record_exchanges_in_gittip():
except KeyError:
gittip_api_key = getpass.getpass("Gittip API key: ")

try:
gittip_base_url = os.environ['GITTIP_BASE_URL']
except KeyError:
gittip_base_url = 'https://www.gittip.com'

for username, email, gross, fee, net in csv.reader(open(GITTIP_CSV)):
url = 'https://www.gittip.com/{}/history/record-an-exchange'.format(username)
url = '{}/{}/history/record-an-exchange'.format(gittip_base_url, username)
note = 'PayPal MassPay to {}.'.format(gross, email)
data = {'amount': '-' + net, 'fee': fee, 'note': note}
requests.post(url, auth=(gittip_api_key, ''), data=data)
Expand Down

0 comments on commit 379409d

Please sign in to comment.