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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:31:02+00:00 2026-05-28T04:31:02+00:00

So im doing a bit of web development, and due to some restriction set

  • 0

So im doing a bit of web development, and due to some restriction set by my employer i need to use cheetah and cherrypy. I have this form that upon submit runs a function, and from said function i call another via HTTPRedirect, and what i want is to call it without redirecting. here is an example

@cherrypy.expose
def onSubmit(**kwargs):
  ##Do something
  ##Do something
  ##Do something

  raise cherrypy.HTTPRedirect("/some_other_location/doSomethingElse?arg1=x&arg2=y")

now i want to do more stuff after running the second function, but i cant because since i redirect the code ends there. So my question is, is there a way to run that other function and not redirect, but still using HTTP. In javascript i would use AJAX and pass it the url, storing the output on the loader variable, but im not sure how to do this with cherrypy

  • 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-28T04:31:03+00:00Added an answer on May 28, 2026 at 4:31 am

    Instead of doing the redirect, use one of the standard Python libraries for fetching HTTP data:

    • http://docs.python.org/library/urllib.html
    • http://docs.python.org/library/urllib2.html

    or other arguably nicer third-party ones:

    • http://docs.python-requests.org/
    • http://code.google.com/p/httplib2/

    Also, don’t forget to convert the relative url to an absolute url, even if it’s localhost:

    To help you get started, here’s an untested code snippet derived from your example, using urllib2:

    import urllib2
    
    @cherrypy.expose
    def onSubmit(**kwargs):
      ##Do something
      ##Do something
      ##Do something
    
      url = "http://localhost/some_other_location/doSomethingElse?arg1=x&arg2=y"
    
      try:
        data = urllib2.urlopen(url).read()
      except urllib2.HTTPError, e:
        raise cherrypy.HTTPError(500, "HTTP error: %d" % e.code)
      except urllib2.URLError, e:
        raise cherrypy.HTTPError(500, "Network error: %s" % e.reason.args[1])
    
      ##Do something with the data
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing the first bit of web-page development I've done in years, in VS2008,
I'm doing a bit of coding, where I have to write this sort of
I have this bit of code, which is working fine: WebKit::WebView web; // later:
I have recently been doing a bit of investigation into the different types of
We're doing a complex bit of data accumulation. Our customer sends us some stuff
I have done impersonation in SharePoint quite a bit in the past by doing
Back again this time working with data providers. Well i been doing a bit
I am doing a PHP web site, without using any framework. I need that
We're not doing real web development. We get our HTMLs from our designers, and
I have been developing web apps (primarily) using php and a bit of python,

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.