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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:05:58+00:00 2026-05-31T23:05:58+00:00

Im new to Twisted. Why is it printing render() twice? I know if I

  • 0

Im new to Twisted. Why is it printing “render()” twice? I know if I return server.NOT_DONE_YET, it will only print once, but I wish to return string/JSON instead. Any help?

Code:

from twisted.web import resource, server
from twisted.internet import reactor
import simplejson

class WResource(resource.Resource):
    isLeaf=True

    def __init__(self):
        print "resource started"

    def render(self, request):
        print "render()"
        request.setHeader('Content-Type', 'application/json')
        return simplejson.dumps(dict(through_port=8080, subdomain='hello'))

reactor.listenTCP(9000, server.Site(WResource()))
reactor.run()

Output:

> python server.py
resource started
render()
render()
  • 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-05-31T23:05:59+00:00Added an answer on May 31, 2026 at 11:05 pm

    Because your web browser is requesting favicon.ico. If you print request.postpath in your render method, you’ll see that only one of the requests is hitting the page that you expect.

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

Sidebar

Related Questions

I tried urllib{2}, pycurl and I'm looking at twisted's new http client. But: I
New to both Ruby and Rails but I'm book educated by now (which apparently
New to WCF, but familiar with COM+ - can I wrap a WCF service
New version of PyPy ships with integrated Stackless . As far as I know
I'm using Twisted to implement a server, of sorts. When I test it, the
I'm trying to make a simple TCP server using Twisted ,which can do some
I'm new to Python, Twisted , and Trial... and for Windows users the setup
New to SQLite so I don't know what I'm doing wrong. I'm just getting
I'm new to twisted and programming, I'm making a multiplayer game, and what i
I am new in python.I installed scrapy but it giving error importerror no module

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.