Python

Control of friends and followers on Twitter (API 1.1 update)

More than 2 years ago (that's a lot of time!) I published a simple Python script to monitor a Twitter account using Tweepy: basic account information, inactive friends and new/lost followers. But this script stopped working some time ago because Twitter updated its API to version 1.1. This update made obligatory using authentication to make any request and they also modified the request limits. Before the update, there was a limit of 150/350 requests per hour, depending on whether the request was authenticated or not, but now these limits are per request type and per 15 minutes. For example, to get a list of friends you can make a maximum of 15 requests per quarter of hour, but you can make other 15 to get a list of followers. If someone is late (like me) with the new API here you can find the full changelog.

Before starting to modify the code I had to update the Tweepy version too (2.1). The best and easiest way is using pip:
 

$ pip install tweepy

 

writeURItoNFCtag


 

Language: Python

Publication date: 2012-07-01

Description: Simple script to write any URI to an NFC tag. Using the 0x00 URI type we can write any type of URI in the tag, without thinking about it. Based on the helloworld.py (nfcpy) script. You can take a look at the different URIs defined by the specification here and other special URIs related to installed mobile applications.

Requirements: nfcpy

Download it!

 


Usage


 

Usage: writeURItoNFCtag.py uri

 

Checking if reading an NFC tag is that secure

As I mentioned in my last post about NFC, we can use NFC Forum tags to store and share information, normally used by marketing departments. This information must have a specific format called NDEF (NFC Data Exchange Format). Thanks to this format different NFC devices can share NDEF messages between them. Each of these messages can store several NDEF records containing different type of information like plain text, images, audio or video (media in general), URIs, etc. You can take a look at the NDEF specification to learn more about it.

 

 

Here I'm going to focus on the URI records and their possibilities to perform actions in NFC capable mobile phones when reading this type of tags. The URI specification says that these are the supported schemes:

 

URI Identifier Codes

Schemes

Control of friends and followers on Twitter

I'm going to lay aside PDF files and malware to write a simple script to control friends and followers on Twitter. We use to have a lot of them and it's difficult to know if our friends haven't written some time ago or our followers have left. But we can use one of the multiple modules (talking about Python) to communicate with the Twitter API and solve this task. I've chosen Tweepy because I think it's very simple and well documented. What we want to obtain from Twitter is:

It's important to highlight that we cannot obtain all the friends/followers with one API request  but  only 100 each time. We can use the Cursors object from Tweepy to solve this very easily:

followersCursor = tweepy.Cursor(tweepy.api.followers,id=user)
for follower in followersCursor.items():
print follower.name

twitCheck


 

Language: Python

Publication date: 2011-08-16

Update: 2013-09-08

Description: Simple script to show details of a given Twitter account: basic account information, inactivity of friends, new and lost followers, etc.

Requirements: Tweepy

Download it!

 


Usage


 

Usage: twitCheck.py twitter_user

 

Syndicate content