Many Pies

Many Pies
Showing posts with label twitter. Show all posts
Showing posts with label twitter. Show all posts

Wednesday, November 16, 2016

My decade on Twitter

Inspired by Jeremy Keith's post A decade on Twitter, I'm doing my own. My first tweet was in July 2006, with a 4 digit id, but so much less interesting than Keith's:

Since then I've gained a large proportion of spam followers, many of them seemingly from Turkey, for no reason I can discern. I've seen what felt like a clubhouse turn into a commercial establishment, with adverts all over the place. I understand that it takes money to run, but after it ran with for many years at the start without adverts, they seem to have taken over relatively quickly. Part of it is the fact that I no longer regularly monitor my two lists ("work" and "play") which have all those I follow on them. As lists don't seem to have adverts the switch to the Twitter app brought a lot more to my attention.

See also, written 7 years ago, Twitter is big, which has subtle boasting about my early adopter status, and also when I heard it mentioned on radio. Another thing I remember from the early days, is when people were saying "there's a real celebrity on here - Wil Wheaton". It was such a geeky thing that we were surprised that someone famous would want to use it. Hard to imagine now, eh?

Friday, May 21, 2010

Display a tweet on a web page - getting around the authentication restrictions

I was working on the Engage page on our website and I wanted to display a single tweet from a particular user. It was a lot more complicated than I thought.
An old version of a similar page used the query (with a bit of JQuery around it)
http://twitter.com/statuses/user_timeline/...

Although that still works, I suspect it will be deprecated. The latest version
http://api.twitter.com/statuses/1/user_timeline/...
requires authentication. That's soon going to require OAuth. It wasn't easy to find much stuff about OAuth and twitter and javascript. Eventually I did find some wisdom about how it was a bad idea on javascript, because it means putting secrets in your code.

So my work around was to create a list with the same name as the user I wanted to display on our corporate twitter account, add that twitter user to it, and use
 http://api.twitter.com/1/user/lists/...
instead. It doesn't require authentication, so works fine!

Wednesday, November 25, 2009

Bug fix to blog post - a meta post

It's not often that you write a blog post to report a bug fix, but I put one on the Wycliffe Bible Translators UK blog recently. The bug was amusing, but probably not many other bugs I found would be even vaguely interesting to anyone.

Tuesday, October 20, 2009

Weather forecast via twitter - wycombeweather

Ages ago I thought it would be handy to have a local weather forecast delivered to my phone, for free. Then twitter came along and it looked like that might provide a possibility. By this time I'd come across the BBC weather RSS feeds.

I tried a couple of "RSS to twitter" services and both worked once and then never again. Google app engine looked like a good way of finding a server to do the stuff to join RSS to twitter. So I cobbled together bits of Python code and came up with this. (Update: September 2010 - updated to use oauth library. You'll need to register your app via dev.twitter.com to get the four keys below. )

(Paste in code from feedparser.org. Comment out the main program stuff.)
(Paste in outh stuff from http://github.com/mikeknapp/AppEngine-OAuth-Library/blob/master/oauth.py)


# Cobbled together from
# http://highscalability.com/using-google-appengine-little-micro-scalability
# http://pydanny.blogspot.com/2008/04/feedparser-does-not-work-with-google.html
import wsgiref.handlers
import urllib
from google.appengine.api import urlfetch
import base64
import feedparser
import StringIO

from google.appengine.ext import webapp

def getWeather():
      content = urlfetch.fetch("http://feeds.bbc.co.uk/weather/feeds/rss/5day/id/2111.xml").content
      d = feedparser.parse(StringIO.StringIO(content))
      if d.bozo == 1:
           raise Exception("Can not parse given URL.")
      return d['entries'][0]['title']

class WeatherText(webapp.RequestHandler):
def get(self):
     self.response.headers['Content-Type'] = 'text/html'

     self.response.out.write(getWeather())
     self.response.out.write('
supported by backstage.bbc.co.uk')


class UpdateWeather(webapp.RequestHandler):
def get(self):
     self.response.headers['Content-Type'] = 'text/plain'

     message = getWeather()
#      self.response.out.write(d['entries'][0]['title'] )
#      message = datetime.now().ctime()
     payload= {'status' : message,}
#      payload= urllib.urlencode(payload, True) Removed when switching to oauth client
# Get rid of degree marks because they turn out as question marks in the final tweet
#      payload = payload.replace('%3F','') degree marks work on twitter, appear as "deg" in txt, still wrong when main URL viewed
#      self.response.out.write(payload)

# Your application Twitter application ("consumer") key and secret.
    # You'll need to register an application on Twitter first to get this
    # information: http://www.twitter.com/oauth
     application_key = "im_not_telling_you"
     application_secret = "nor_this"
  
    # Get these from http://dev.twitter.com/apps/your_app_number/my_token
     user_token = "this_is_a_secret"
     user_secret = "this_is_definitely_a_secret"
  
    # In the real world, you'd want to edit this callback URL to point to your
    # production server. This is where the user is sent to after they have
    # authenticated with Twitter.
     callback_url = "%s/verify" % self.request.host_url
  
     client = TwitterClient(application_key, application_secret, callback_url)
     result = client.make_request("http://api.twitter.com/1/statuses/update.xml", token=user_token, secret=user_secret, additional_params=payload, protected=False, method=urlfetch.POST)
# Removed when oauth implemented
#      base64string = base64.encodestring('%s:%s' % (login, password))[:-1]
#      headers = {'Authorization': "Basic %s" % base64string}
#
#      url = "http://twitter.com/statuses/update.xml"
#      result = urlfetch.fetch(url, payload=payload, method=urlfetch.POST, headers=headers)
#
     self.response.out.write(result.content)


def main():
  application = webapp.WSGIApplication([('/', WeatherText),
('/updateweather',UpdateWeather)],
                                       debug=True)
  wsgiref.handlers.CGIHandler().run(application)


if __name__ == '__main__':
  main()

 You can see the results at twitter.com/wycombeweather and wycombeweather.appspot.com. If you want to do it for your local UK weather you'll need to change the figure 2111 above and use your own twitter account.

Tuesday, May 05, 2009

Twitterings at Wycliffe

I've done a trio of twitter related pages for Wycliffe UK:

Latest tweet from various Wycliffe people, myself at the top of course (I had just mine for testing, and added other people afterwards you see).

As above in reverse chronological order.

Tweets mentioning #wycliffeuk.

Tuesday, April 28, 2009

Twitter is big

If you went back in time 25 years ago and said "in 25 years time the geeks will be cool" I think no-one would believe you. 25 years ago geeks like me were fiddling around with the BBC B and the cool kids had guitars.

A few highlights over the years:
I worked for a company that was on the internet before the web was invented and we had gopher and wais, but most of all Usenet. Then Mosaic came along.

A bit later I heard the internet mentioned on the Radio 4 News Quiz (still going). Then URLs appeared on adverts. The internet was becoming mainstream.

There were online journals and then Peter Merholz invented the word "blog". I was reading his blog at the time.

Blogs became mainstream and Gary Lineker said during the World Cup 2006 (I think) "what's a blog?". He probably knows now.

In 2006 Twitter was launched. It was called twttr at first because we were short of vowels in those days (see Flickr). I was the 791st person to sign up. Now there are millions of users.

A year or so after that I heard twitter mentioned by a radio DJ, but it didn't have a high profile and it was still in the realm of us geeks. Us geeks love to rush around saying "jaiku!" "friendfeed!" "diggit!" and other Latest New Things. However Twitter is now mentioned regularly on TV, radio and dead tree media so I think I can safely say

Twitter is big