O'Reilly Forums: Chapter 3 Twitter - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Chapter 3 Twitter

#1 User is offline   Longhair 

  • New Member
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 01-May 14

Posted 01 May 2014 - 01:08 AM

I've been stuck on Chapter 3 due to the Twitter changes. After reading some solutions, I decided to try to push through myself.

Twitter requires a mobile phone number to change a setting from read only to read, write and Access direct messages. This is not something that I am willing to do considering the only reason I signed up for twitter in the first place was to follow along with chapter 3.
0

#2 User is offline   #TM# 

  • Active Member
  • PipPipPip
  • Group: Members
  • Posts: 60
  • Joined: 10-December 12
  • Gender:Not Telling

Posted 04 May 2014 - 01:46 AM


@ Longhair,

Thanks for the information.

I am also disappointed about this.

But the big companies keep changing these things for security purposes.

I am sorry to say that you cannot post or write into your time line from now on; without this mobile number business :( :blink:

twitter is not taking even my mobile number. For now, they have neglected Indian telecom providers.

I have tried two of my mobile numbers from two different telecom providers and all they have to say is "yours is not included". SHAME ON YOU TWITTER. <_< :angry:


But you can read from your time line, read your friends timeline, search latest tweets from someone etc. Yes ! you can do that. Below one is an example. Use below codes which will give you list of first ten user name who have posted in your twitter timeline. Check it by going to your twitter account.

At least you will get a feel of twitters apps' working process.

import twitter as t
import urllib.request as ur
import time

CONSUMER_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
CONSUMER_SECRET = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
ACCESS_TOKEN_KEY= 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
ACCESS_TOKEN_SECRET= 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

def tweet():
	authkey = t.Twitter(auth=t.OAuth(ACCESS_TOKEN_KEY, ACCESS_TOKEN_SECRET, CONSUMER_KEY, CONSUMER_SECRET))
	tl = authkey.statuses.home_timeline()
	
	# Get first ten user names who posted in your timeline.
	for i in range(10):
		print (tl[i]['user']['screen_name'])
	
	# Get data from your friends  timeline (here tesla_bot)
	ftl = authkey.statuses.user_timeline(screen_name="tesla_bot")
	print (ftl[1]['user']['description'])
	
	# Search for the latest tweets about followers or following (here @pyconindia)
	tw = authkey.search.tweets(q="@pyconindia")
	print (tw) # It will be printed in a combination of dictionary, lists etc. format. 
	#I kept it like that so that you can learn to parse specific details.
	#Follow the above two examples to find out the way to print a specific thing.

tweet()



Additionally you can follow below link for more detail.

python twitter 1.14.3 package details with examples

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users