Pure Gangsters, Tweet, Tweet

I always like to warn my dear non-techy blogger friends when something technical is coming their way so that they can go onto reading something else. This is one of those times.

In this post, I want to show you how to get your Twitter tweet button count to increment and display properly on your web page.  In this case, I’m using Google app engine’s python implementation, but this could apply for you on a different tech stack.

Generally this isn’t going to be an issue, but you never know, so since I had taken the trouble to do this, I hope it helps someone out one day if they stumble across it in a search engine.

I propped up my stellar gangster kids and tweeted it, but noticed my tweet count didn't increment up. What to do?

I propped up my stellar gangster kids and tweeted it, but noticed my tweet count didn’t increment up. What to do?

I tweeted this picture from proppitup.com.  When I tweeted it, I expected my tweet count to go up by one. From zero to one to be exact. But it didn’t, it just stayed at zero. It could have been cached or any number of things, but I suspected not. Just a hunch. I was right.

The problem was that my server-side code wasn’t properly handling head() requests. I realized I’d need to when I stumbled across this note from Twitter that indicated it was required.

So using curl, here’s what it looked like before. Bad error 405.

curl_error405

So I implemented a quick head() method to see if that was the culprit.

def head(self):
    #this allows twitter callback to work
    #https://dev.twitter.com/docs/tweet-button/faq#count-api-increment
    return

And here’s what it looked like afterwards.

curl_success200

And what do you know, it worked. My twitter propp count just went up by one. Success!

pure_gangsters

Advertisements
Leave a comment

3 Comments

  1. Cute picture, even though I have no idea what the heck you are talking bout! 🙂

    Reply
  2. Great pic!

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: