Nathan Pryor is a 41-year-old software project manager in Vancouver, WA. This post first appeared on Medium and is reprinted here with permission.
Ars asked Pryor if his code could easily be altered to donate to other
organizations. His response: "It depends on one's threshold of 'easy.'
It's coded specifically for the ACLU donation form. Re-doing it for
another charity would require taking a look at the source code for their
donation page, then changing the name of the fields that I call out in
the code."
You may have heard of Amazon’s Dash Button,
the physical “Buy Now” button for your home. With no interface other
than a logo and a large round button, each Dash is a product-specific
wi-fi device. Tapping it automatically places an order to have that
product delivered into your waiting arms.
Stick one on your washing machine, and when
you run low on detergent, tap! A box of Tide shows up two days later.
Stick a few in your cupboard, and tap! Tap! Tap! Goldfish crackers,
Cheez-Its, Doritos, on their way! Hundreds of Dash buttons are available
to deliver the instant gratification of consumerism at its finest—or at
its worst, depending on your perspective.
Why not push a button and do some real good?
It was my friend Katherine
who made the comment “I wish there was an ACLU Dash button I could push
to donate any time I read about the latest offense from Trump.” Her
language was sliiiiightly more
colorful than that, but it got me thinking: why reserve that instant
gratification for physical goods? Why not push a button and do some real good?
After its release in 2015, savvy techies
quickly realized that a Dash Button could be hacked and subverted into
performing other tasks, from ordering pizza to tracking baby poops. It wasn’t simple, and it definitely wasn’t supported by Amazon.
In 2016, Amazon responded to the demand and released a customizable version of the Dash Button— the IoT Button,
“IoT” being an abbreviation for “Internet of Things.” Tech-minded users
could now more easily build and program their own Dash-style buttons.
I ordered my IoT button and dove into the server-side programming while I waited for it to arrive. There’s no donation API (Application Programming Interface) that I could find to automate the process of sending money to the ACLU,
so the first order of business was analyzing the donation form so it
could be filled programmatically and submitted. Name, address, email,
credit card info—all straightforward.
I wrote a script in Python using the Mechanize library. Then I built that into a function at Amazon’s AWS Lambda
service. Lambda lets you run small programs like this when you don’t
need a full time server—you literally pay only for the milliseconds that
your script runs. When it’s triggered, the script loads up the donation
page, fills the fields with my name, address, and credit card info,
then submits it. If it’s successful, it sends me a text message to let
me know.
Using a prepaid gift card so that my bank
account wouldn’t empty if the script got stuck in some kind of infinite
donation loop, I clicked the “Test” button on Amazon’s site. Success!
Two days later, the IoT button arrived, and I dove into the work of hooking it into the script I’d built. It’s supposed to be almost
plug-and-play, with a helpful iPhone app to connect and set everything
up. But the app was never able to complete the process. After hours of
frustration and troubleshooting, I eventually got the IoT button
registered manually and linked it to the script I’d written. Another
test, another $5 to the ACLU.
Finally, because looks rank right up there
with function, I designed a graphic for the button. I printed it and
stuck it in place so it looks more like a real Dash button.
The button resides near my laptop now, and
every press sends another $5 into the fight. Sure, I could set up a
recurring donation every month, but then I’d lose the tactile thrill of
the press, and I wouldn’t have learned my way around this technology.
If you do want to try making your own, you can download the code I used for the donation button,
but I make no claims as to its suitability or security. It isn’t robust
in any way—if the ACLU changes a field name or the way the donation
page works, the code’ll break. There’s no error handling. It’s not
PCI-compliant. No safeguards will keep the button from emptying your
bank account if it gets stuck down or your cat decides to paw at it. Use
it at your own risk, and don’t complain to me about it.
Comments
Post a Comment