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 9193471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:10:21+00:00 2026-06-17T21:10:21+00:00

i have the next code: from wsgiref.simple_server import make_server from pyramid.config import Configurator from

  • 0

i have the next code:

from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
import tweepy

consumer_key=""
consumer_secret=""
access_key = ""
access_secret = "" 

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.friends_timeline).items(20)
    for status in statuses:
        return list(str(status.text))

this twitterfeed() method is working on the bash/console, and shows the latest tweets of me and my subscribers. But when i want to show this tweets on the page:

if __name__ == '__main__':
    config = Configurator()
    config.add_route('hello', '{name}')
    config.add_view(twitterfeed(), route_name='hello')
    app = config.make_wsgi_app()
    server = make_server('0.0.0.0', 8080, app)
    server.serve_forever()

it shows me pyramid.exceptions.ConfigurationExecutionError: <type 'exceptions.AttributeError'>: 'list' object has no attribute '__module__'
in:
Line 24
error

how can i fix it? if you have working example from django, it can help me.

  • 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-17T21:10:23+00:00Added an answer on June 17, 2026 at 9:10 pm

    You should register the function, not the result of the function:

    config.add_view(twitterfeed, route_name='hello')
    

    otherwise you are trying to register the list returned by twitterfeed as a view instead.

    Note that your function needs to accept a request parameter too; and it’ll have to return a response object too. Change it to:

    from pyramid.response import Response
    
    def twitterfeed(request):
        auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
        auth.set_access_token(access_key, access_secret)
        api = tweepy.API(auth)
        statuses =  tweepy.Cursor(api.friends_timeline).items(20)
    
        return Response('\n'.join([s.text.encode('utf8') for s in statuses]))
    

    I’ve taken the liberty of encoding the tweets to UTF8 instead of leaving it up to Python to pick a default encoding for them (which will lead to UnicodeEncodeError exceptions if there are any international characters in your tweets).

    You really want to read up on pyramid views before you continue.

    As an aside, your command-line version returned only first tweet as a list of individual characters (return list(str(status.text))).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

myRs=myStmt.executeQuery(select i_col,col_name from tab_col) i=0 while (myRs.next()): list= myRs.getString(I_COL)+','+myRs.getString(COL_NAME) i have a jython code
I have the next code to retrieve some data from a xml file. The
I have the next code. I save it in the file: 'MysqlConnect.java'. import java.sql.*;
I have thi next code, but he doesn't work: $select_sell = $this->select(); $select_sell->from($this->_name, array('rank_id'))
I have next code which creates a print page with data from datagridview. Font
I have next code which creates a print page with data from datagridview. Font
I have next code, <form id=form1 runat=server> <asp:Label runat=server ID=Label1 EnableViewState=false /> <asp:CheckBox runat=server
I have next code: int main() { OwnSelect(23, FD_READ | FD_WRITE); // <---- Several
I have next code require 'rack/rpc' class Server < Rack::RPC::Server def hello_world Hello, world!
I have the next code: class Printer{ Activity activity; public Printer (Activity activity) {

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.