Michael Jay Lissner
  • Home
  • About Site
  • Contact
  • Projects & Papers
  • Tags
  • Archives

A Python Function to Verify Twitter Credentials

Thought I’d post this for the future generations, since I had a hard time finding a template anywhere on the web when I needed one. It’s nothing revolutionary, but a useful snippet nonetheless. This is for one of my projects this semester.

import pycurl


def verifyTwitterCredentials(username, password):
    c = pycurl.Curl()
    c.setopt(c.URL, 'http://twitter.com/account/verify_credentials.xml')
    c.setopt(c.USERPWD, username + ":" +  password)
    twitterfeed = c.perform()

    status = c.getinfo(c.HTTP_CODE)

    if str(status) == '200':
        verified = True
    else:
        verified = False

    c.close()

return verified

I love getting feedback and comments. Make my day by making a comment.

Comments
comments powered by Disqus

  • « An Analysis of FTC Behavioral Advertising and an End of Semester Countdown
  • A Real Problem You Should Fix. Now. »

Published

Apr 3, 2009

Category

Tech

Tags

  • Programming 7
  • PyCurl 1
  • Python 9
  • Twitter 4

Contact

This is Reader-Editable

Edit this post on Github

Get Weekly Updates

  • Unless mentioned otherwise, all material on this site is licensed under a Creative Commons copyright or the GNU Affero GPL. Privacy Policy.
  • Powered by Pelican. Theme: Elegant by Talha Mansoor