Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9285071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:04:04+00:00 2026-06-18T19:04:04+00:00

I am trying to download tweets from twitter. I have used python and Tweepy

  • 0

I am trying to download tweets from twitter.

I have used python and Tweepy for this. Though I am new to both Python and Twitter API.

My Python script is as follow:
#!usr/bin/python

#import modules
import sys
import tweepy
import json

#global variables
consumer_key = ''
consumer_secret = ''
token_key = ''
token_secret = ''

#Main function
def main():
    print sys.argv[0],'starts'
    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
    auth.set_access_token(token_key, token_secret)
    print 'Connected to Twitter'
    api = tweepy.API(auth)
    if not api.test():
        print 'Twitter API test failed'

    print 'Experiment with cursor'
    print 'Get search method returns json objects'

   json_search = api.search(q="football")
   #json.loads(json_search())
   print  json_search


#Standard boilerplate to call main function if this file runs

if __name__ == '__main__':
    main()

I am getting result as follows:

[<tweepy.models.SearchResult object at 0x9a0934c>, <tweepy.models.SearchResult object at 0x9a0986c>, <tweepy.models.SearchResult object at 0x9a096ec>, <tweepy.models.SearchResult object at 0xb76d8ccc>, <tweepy.models.SearchResult object at 0x9a09ccc>, <tweepy.models.SearchResult object at 0x9a0974c>, <tweepy.models.SearchResult object at 0x9a0940c>, <tweepy.models.SearchResult object at 0x99fdfcc>, <tweepy.models.SearchResult object at 0x99fdfec>, <tweepy.models.SearchResult object at 0x9a08cec>, <tweepy.models.SearchResult object at 0x9a08f4c>, <tweepy.models.SearchResult object at 0x9a08eec>, <tweepy.models.SearchResult object at 0x9a08a4c>, <tweepy.models.SearchResult object at 0x9a08c0c>, <tweepy.models.SearchResult object at 0x9a08dcc>]

Now I am confused how to extract tweets from this information?
I tried to use json.loads method on this data. But it gives me error as JSON expects string or buffer.
Example code would be highly appreciated.
Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T19:04:06+00:00Added an answer on June 18, 2026 at 7:04 pm

    take my code for tweepy:

    def twitterfeed():
       auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
       auth.set_access_token(access_key, access_secret)
       api = tweepy.API(auth)
       statuses = tweepy.Cursor(api.home_timeline).items(20)
       data = [s.text.encode('utf8') for s in statuses]
       print data
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to download share data from a stock exchange using python. The problem
I am trying to download a file from a website using python and mechanize.
I'm trying to download the XLS file from this page: http://www.nordpoolspot.com/Market-data1/Elspot/Area-Prices/ALL1/Hourly/ (click on Export
I am trying to download some image file from Google Drive using the python
I have been trying to download videos from a url, I have implemented my
I'm trying to download a file from an opa database. I've used the following
Im trying to download profile_image_url images (.jpg) from twitter and display them in my
I am trying to download some files. I have written a php script that
I am trying to download the perl scripts from this site: http://pages.cs.wisc.edu/~david/courses/cs552/S12/handouts/bins/ When I
I am trying to download an mp3 file from google TTS API, here is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.