Skip to content

Commit

Permalink
look for email address in the memo
Browse files Browse the repository at this point in the history
  • Loading branch information
valzav authored and xeroc committed Oct 29, 2015
1 parent 31ea4a3 commit 0cb911c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/monitor-refcode/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,21 @@ def process_operations(self, operations) :
memomsg))

# Parse the memo
pattern = re.compile('[a-zA-Z0-9]{8}')
pattern = re.compile('[A-Z0-9]{3}-[A-Z0-9-]{8}')
searchResults = pattern.search(memomsg)
if not searchResults:
continue
ref_code = searchResults.group(0)

email = ""
pattern = re.compile('[a-z0-9][-a-z0-9_\+\.]*[a-z0-9]\@.+\.[a-z]+')
searchResults = pattern.search(memomsg.lower())
if searchResults:
email = searchResults.group(0)

# Request to Faucet
headers = {'content-type': 'text/plain'}
query = "refcode[code]=%s&refcode[account]=%s&refcode[asset_symbol]=%s&refcode[asset_amount]=%s" % (ref_code, from_account["name"], amount_asset["symbol"], op["amount"]["amount"])
query = "refcode[code]=%s&refcode[account]=%s&refcode[asset_symbol]=%s&refcode[asset_amount]=%s&refcode[send_to]=%s" % (ref_code, from_account["name"], amount_asset["symbol"], op["amount"]["amount"], email)
print("--- query: %s" % query)
response = requests.post(config.faucet_url,
params=query,
Expand Down

0 comments on commit 0cb911c

Please sign in to comment.