• Random
  • Archive
  • RSS
  • Ask me anything
banner

Earn some easy brownie points from your SO with Python, CRON & Pair

Pair has been cropping up a lot recently. Nearly every ‘Top X from Y Combinator’s Demo Day’ has Pair somewhere on the list. One of the cutsey features is a “Thinking of you” button. A single tap and you can let your loved one know they’re on your mind. ♥ ♥ Awwwww.

But it can work to your disadvantage. What if you don’t tap that button often enough? Instant cold shoulder. Now I’m not suggesting that you don’t think about your loved one on a regular basis, but when you do you’re not going to immediately reach for your phone, open the app and tap the button. So how can we make things easier? Lets estimate you think about your SO once an hour. Anytime I have a task I perform on a regular basis I tend to automate it with CRON. So lets do that here.

First thing I had to do was create a Pair account, and persuade my fiancé to actually pair with me (after a lot of eye-rolling she finally agreed). Then it was time to break out mitmproxy. There’s quite a big API to explore, but for this task I just focused on the “Thinking of you” requests, which is called a “nudge” by their API. But before you can send a nudge you have to authenticate.

mitmproxy Screenshot

The authenticate request returns an ‘authenticationToken’ (when successful) which we can use in subsequent requests. I’m unsure as to the life-span of this token so I request a new one before each nudge, you might want to experiment a little here.

Once we have authenticated we can now send our nudge request.

sending a nudge

I might have got a little carried away while testing…

Pair Screenshot

I’ve written a quick Python script to automate everything (it uses the excellent requests HTTP library). You can download it from Github. Once you have it setup just add python brownie_points.py > /dev/null to CRON at your preferred interval and begin racking up those brownie points.

If you’re worried about your partner smelling a rat when you suddenly begin “thinking of them” on the hour every hour, get creative. Use CI? Add the script to Jenkins so it runs when you deploy or you could call the script every-time you have a coffee (via RFID).


BTW, Level Up is taking bookings now for new projects. Got an interesting project you think we could help with? Or just need some friendly Python/Django developers? Then drop me an email or tweet @aaronbassett

    • #python
    • #pair
  • 1 year ago
  • 2
  • Comments
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

2 Notes/ Hide

  1. thisislevelup posted this

Recent comments

Blog comments powered by Disqus
← Previous • Next →

Logo

About

Level Up are a technology company based in Glasgow, Scotland. Tell us your goals and we will work with you to develop a solution that fits.




Find us on Github, Facebook, Last.fm, Twitter, Delicious, Forrst and LinkedIn.

Social

  • Aaron on Forrst
  • @thisislvlup on Twitter
  • Facebook Profile
  • thisislvlup on Vimeo
  • lvlup on Delicious
  • thisislevelup on Last.fm
  • Linkedin Profile
  • Level-Up on github

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Ask me anything
  • Mobile

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License..

Effector Theme by Pixel Union