from pprint import pprint from django.conf import settings from django.http import Http404, HttpResponse from apps.newsletters.models import EmailNewsletter from apps.rss_feeds.models import Feed, MStory from utils import log as logging def newsletter_receive(request): """ This function is called by mailgun's receive email feature. This is a private API used for the newsletter app. """ # params = { # 'stripped-signature':'Thanks,\nBob', # 'From':'Test mailer ', # 'attachment-count':'2', # 'To':'Alice ', # 'subject':'Test Newsletter The Skimm', # 'from':'Test mailer ', # 'User-Agent':'Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4', # 'stripped-html':'\n
\n
Hi Alice,
\n

\n
This is Bob. 
\n

\n I also attached a file.

\n
Thanks,
\n
Bob
\n

\n
', # 'In-Reply-To':'<517AC78B.5060404@newsletters.newsblur.com>', # 'Date':'Fri, 26 Apr 2013 11:50:29 -0700', # 'Message-Id':'<517ACC75.5010709@newsletters.newsblur.com>', # 'body-plain':'Hi Alice,\n\nThis is Bob.\n\nI also attached a file.\n\nThanks,\nBob\n\nOn 04/26/2013 11:29 AM, Alice wrote:\n> Hi Bob,\n>\n> This is Alice. How are you doing?\n>\n> Thanks,\n> Alice\n\n', # 'Mime-Version':'1.0', # 'Received':'from [10.20.76.69] (Unknown [50.56.129.169]) by mxa.mailgun.org with ESMTP id 517acc75.4b341f0-worker2; Fri, 26 Apr 2013 18:50:29 -0000 (UTC)', # 'content-id-map':'{"": "attachment-1"}', # 'Sender':'bob@newsletters.newsblur.com', # 'timestamp':'1455054990', # 'message-headers':'[["Received", "by luna.mailgun.net with SMTP mgrt 8788212249833; Fri, 26 Apr 2013 18:50:30 +0000"], ["Received", "from [10.20.76.69] (Unknown [50.56.129.169]) by mxa.mailgun.org with ESMTP id 517acc75.4b341f0-worker2; Fri, 26 Apr 2013 18:50:29 -0000 (UTC)"], ["Message-Id", "<517ACC75.5010709@newsletters.newsblur.com>"], ["Date", "Fri, 26 Apr 2013 11:50:29 -0700"], ["From", "Test mailer "], ["User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4"], ["Mime-Version", "1.0"], ["To", "Alice "], ["Subject", "Re: Sample POST request"], ["References", "<517AC78B.5060404@newsletters.newsblur.com>"], ["In-Reply-To", "<517AC78B.5060404@newsletters.newsblur.com>"], ["X-Mailgun-Variables", "{\\"my_var_1\\": \\"Mailgun Variable #1\\", \\"my-var-2\\": \\"awesome\\"}"], ["Content-Type", "multipart/mixed; boundary=\\"------------020601070403020003080006\\""], ["Sender", "bob@newsletters.newsblur.com"]]', # 'stripped-text':'Hi Alice,\n\nThis is Bob.\n\nI also attached a file.', # 'recipient':'samuel-555551235342@newsletters.newsblur.com', # 'sender':'samuel@ofbrooklyn.com', # 'X-Mailgun-Variables':'{"my_var_1": "Mailgun Variable #1", "my-var-2": "awesome"}', # 'token':'cb2ef40ca2fee03a099f7da78ca07384228f00f023026c77a4', # 'body-html':"""\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n Is this email not displaying correctly?\r\n View it in your browser.\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n Skimm’d at Friendsgiving with coffee that tastes like your fav baked goods. Drink up here.\r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n QUOTE OF THE DAY\r\n
\r\n

“What up, peach butt?” - One person’s reaction to Apple bringing back the OG peach emoji. Because the Internet loves big peaches and it cannot lie.

\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n

FAKE \'N BAKE

\r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n

THE STORY

\r\n

Facebook and Google are trying to stop certain websites from faking it.

\r\n

WAIT…BACK UP.

\r\n

During and after the presidential election, there were a lot of fake news articles floating around the Interwebs - especially on Google and Facebook. See: stories on Facebook claiming that Pope Francis and Denzel Washington had endorsed Donald Trump. False. Also see: a news story leading Google’s search results claiming that Trump had won the popular vote. Again, false.

\r\n

HOW DID THIS HAPPEN?

\r\n

Both Google and Facebook use algorithms to decide what people see in their search results and News Feeds. And people are more likely to see websites and stories that are already getting attention. During this election, people were apparently clicking a lot on attention grabbing - but fake - stories. So Google and Facebook have been got a lot of side eye for maybe helping spread false news that misled voters.

\r\n

SO WHAT NOW?

\r\n

Earlier this week, both tech companies said they’re banning fake news sites from using their ad platforms. Hint: tools that help other websites make some cash money by filling ad spaces on their pages. So this move could hit fake sites where it hurts…their bank accounts. But these actions won’t actually stop fake stories from showing up in search results and News Feeds. So, problem not solved.

\r\n

theSKIMM

\r\n

Turns out your grandma who always says ‘don’t believe what you read on the Internet’ is onto something. The issue is that lately, it’s been getting harder to tell fact from fiction. Think of Google and Facebook’s moves as baby steps in the right direction.

\r\n

THE *: Twitter’s also battling some demons. Yesterday it announced a new ‘mute’ button for hate speech that can be used to block trolls. Slow. Clap.

\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n

REPEAT AFTER ME...

\r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n

WHAT TO SAY TO YOUR FRIEND WHO OVERUSES THE FLOWER CROWN FILTER…

\r\n
\r\n

Big news. Yesterday, it came out that Snapchat - aka Snap Inc. - reportedly filed to go public. The Dancing Ghost could start trading shares as soon as March next year. And be valued at around $25 billion. That would make it one of the largest IPOs since Alibaba went public in 2014 for more than $170 billion. Not bad for a company that once said ‘as if’ to a $3 billion takeover bid from Facebook. Now, the app known for high-pitched deer voices and major key has more than 100 million active users. Snapchat’s not sending any disappearing comments confirming or denying these reports. For now.

\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n

WHAT TO SAY WHEN DECIDING BETWEEN TAKEOUT AND LEFTOVERS…

\r\n

\r\n
\r\n

Decisions, decisions. DC’s making a lot of those too. Yesterday, House Republicans re-nominated Rep. Paul Ryan (R-WI) for House Speaker. So he’ll continue as the voice of the GOP in Congress when President-elect Donald Trump takes over the White House. Ryan and Trump haven’t been huge fans of each other in the past, so this could be fun. Meanwhile, House Dems are in ‘reassess’ mode since last week’s election upset. Yesterday, they postponed an election for House Minority Leader until the end of the month. So it’s unclear whether current leader Rep. Nancy Pelosi (D-CA) will get to keep her job, which she’s had for more than a decade. Speaking of jobs, some of Trump’s transition team members don’t have one anymore. Yesterday, two aides that were helping with national security and foreign policy were pushed out. One of them reportedly over his close ties to NJ Gov. Chris Christie - who was recently demoted from his own transition team job - and his bridge full of problems. VP-elect Mike Pence is heading everything up now. And he has a lot of open positions to fill on the US gov’s website. Bueller…?

\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n

WHAT TO SAY TO YOUR FRIEND WHO ‘CHECKED IN’ TO STANDING ROCK ON FB

\r\n

\r\n
\r\n

And the story continues. Earlier this week, the company building the Dakota Access Pipeline asked a federal court to step in and give them the green light to finish the project. That’s because the US gov recently put off making a decision about whether pipeline construction could continue near a Native American reservation in North Dakota. Reminder: The Dakota Access Pipeline is a more than 1,000 mile-long oil pipeline that would run through four states. Native Americans and environmentalists have spent months protesting the project in North Dakota, saying it could contaminate the water supply of a nearby tribe and demolish sacred sites. The tribe filed a lawsuit, and after a lot of legal back-and-forth, the project’s been put on hold by the Obama administration. Now, the pipeline company’s saying delays have cost about $100 million and it’s ‘time to get this show on the road.’ Meanwhile critics are saying ‘nope, fight’s not over.’ Yesterday, hundreds of people protested in cities across the US.

\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n

WHAT TO SAY WHEN YOU FIND A HAIR IN YOUR SOUP...

\r\n
\r\n

That’s nothing. Really.

\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n

THING TO KNOW

\r\n
\r\n

Young Joe Biden: A picture of Vice President Joe Biden. When he was younger. And really, really, really, ridiculously good looking. And when ‘malarkey’ might have worked in a pickup line.

\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n

SKIMM LIFE

\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n
\r\n
\r\n

Pillow talk just got a lot more comfortable. Meet your new mattress that will make it extra hard to get out of bed. $50 off included. Get it here.

\r\n

 

\r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n

SKIMM SHARE

\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n
\r\n
\r\n Share theSkimm\r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n

SKIMM BIRTHDAYS

\r\n
\r\n

* indicates Skimm’bassador. Go big.

\r\n
\r\n

Trish Engleman (New York, NY); Sarah Finn (New York, NY); *Jackie O’Shaughnessy (Chapel Hill, NC); *Gabriella Rossi (New York, NY); *Jenna Levy (Baltimore, MD); *Allison Wynant (North Potomac, MD); *Heather Modicut (Loranger, LA); *Mirela Raic (Dubai, UAE); *Heather McCowen (Chicago, IL); *Kimberly Novosel (Nashville, TN); *Armand Mignot (Boston, MA); *Beth Zentmeyer-Harvey (Tampa, FL); *Sue Fannin (Greensboro, NC); *Sokphal Tun (Arlington, VA); *Mary Augustine-Morris (New York, NY); *Lisa Watkins (Austin, TX); *Alexandra Perrault (Cincinnati, OH); *Courtney Crotty (Glendale, CO); *Keri Robinson (Highland, NY); *Rachel Gold (Denver, CO); Caitriona Brannigan (Dresher, PA); Jessica Reagan (Cary, NC); Rachael Drake (Covington, KY); Abbie Gabel (Lincoln, NE); Sarah Catherine Norris (Dallas, TX); Erika Sorensen (West Fargo, ND); Laurie Crane (Augusta, GA); Alli Fleder (New York, NY); Brenna Delk (Houston, TX); Mary A McKay (Lubbock, TX); Melissa Gay (Chicago, IL); Susanne Erni (Atlanta, GA); Shayla Castrelos (Springfield, NJ); Russell VanDommelen (Byron Center, MI); Olivia Gay (Chicago, IL); Katie Otto (Park Ridge, IL); Nancy Thorpe Calhoun (Plano, TX); Allie Sauls (Houston, TX); Kendra Harris (Traverse City, MI); Kelsey Bowman (Washington, DC); Teresa Decker (Ames, IA); Hannah Epstein (Ann Arbor, MI); Shelby Harris (Traverse City, MI); Bridget Mayer (Chicago, IL); Megan Hewett (Cincinnati, OH); Kaitlyn Watson (Richmond, VA); Sean Levitt (Encino, CA); Amy Babington (Brooklyn, NY); Dominique Buhl (Portland, OR); Ali Kaiser (Denver, CO); Andrea Brzozoski (Atlanta, GA); Karen Grant-Davie (London, England); Kelly LearyKelsey ShoretteKiva Eisenstock (Pacific Palisades, CA); Lauren Ciaccio Sistrunk (New Orleans, LA); Lillian Anselmi (New York, NY); Samantha Sullivan (Boston, MA); Jessica Sheely (Houston, TX); Sharona Sokolow (Los Angeles, CA)

\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n Skimm\'d something we missed?\r\n
\r\n
\r\n Email SkimmThis@theSkimm.com Read in browser »\r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n Copyright © 2016 theSkimm, All rights reserved.\r\n
\r\n Our mailing address is:
\r\n theSkimm Inc.
\r\n 49 W 23rd Street, 10th Floor
\r\n New York, NY, 10010, United States\r\n
\r\n Update Profile
\r\n Unsubscribe\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n\r\nAdvertisement\r\nAdvertisement\r\n\r\n\r\n # """, # 'References':'<517AC78B.5060404@newsletters.newsblur.com>', # 'signature':'1369fa4dcc7de7fac51f5bb408bd5c9daa8730e80d394e8a128658d74e66904skimm2', # 'Content-Type':'multipart/mixed; boundary="------------020601070403020003080006"', # 'Subject':'Test Newsletter theskimm' # } params = request.POST response = HttpResponse("OK") if settings.DEBUG or "samuel" in params.get("To", ""): logging.debug(" ---> Email newsletter: %s" % params) if not params or not len(params.keys()): logging.debug(" ***> Email newsletter blank body: %s" % request.body) raise Http404 email_newsletter = EmailNewsletter() story = email_newsletter.receive_newsletter(params) if not story: raise Http404 return response def newsletter_story(request, story_hash): try: story = MStory.objects.get(story_hash=story_hash) except MStory.DoesNotExist: raise Http404 story = Feed.format_story(story) return HttpResponse(story["story_content"])