473,698 Members | 2,571 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Http protocol Script

12 New Member
Hi,
I am new to Python and wrote a http protocol script. I got this error please slove this

my server:::



import string,cgi,time

from os import curdir, sep

from BaseHTTPServer import BaseHTTPRequest Handler, HTTPServer





class MyHandler(BaseH TTPRequestHandl er):



def do_GET(self):

try:
send_response(2 00)

send_header('Co ntent-type','text/html')

send_headers()





except IOError:

send_error(404, 'File Not Found: %s' % self.path)


def xyz():

send_responce(2 00)
send_headers('C ontent_type','t ext/html')







def main():

try:

server = HTTPServer(('', 50), MyHandler)

print 'started httpserver...'

server.serve_fo rever()

except KeyboardInterru pt:

print '^C received, shutting down server'

server.socket.c lose()



if __name__ == '__main__':

main()





My client:::

import httplib

conn=httplib.HT TPConnection('l ocalhost',50)
conn.request('x yz','index.esp' )
r=conn.getrespo nse()
print r.status


Error I got:::

localhost.local domain - - [14/Sep/2007 11:43:53] code 501, message Unsupported method ('xyz')
localhost.local domain - - [14/Sep/2007 11:43:53] "xyz index.esp HTTP/1.1" 501
Sep 14 '07 #1
0 933

Sign in to post your reply or Sign up for a free account.

Similar topics

8
10642
by: turnit \(removethis\) | last post by:
I have a login form that uses the post method to carry the information to the next page. The form works just fine in ie6.0, but fails in mozilla and fails in ie5.2 on a mac. "HTTP/1.1 400 Bad Request" was the original error msg now that I reinstalled iislockdown and urscan I get "The parameter is incorrect." If I use the get method with this form it works just fine on everything. I can't say for certain but I think this problem started...
1
15087
by: Newbie | last post by:
I have set up an ASP script (with some help from microsoft.public.inetserver.asp.general!) that grabs the windows username of the user and puts it into an Access database. It is setup on IIS5 as a virtual directory and will only be used internally on our network. The script works fine with the authentication set as "basic authentication" but this prompts the user for a login and password. I want it to be automated which I believe would...
4
2475
by: Bob Badger | last post by:
Hi, Simple question (although I guess with a complicated answer). Is HTTP an async protocol? For instance, if I send a message to a c# webservice via http what is the protocol actually doing? Thanks in advance Steffan
7
9921
by: Wladimir Borsov | last post by:
I want to call a perl script myscript.pl in my cgi-bin from a HTML web page. This call should NOT use SSI (because in this case HTTPS://.... protocol is necessary). Furthermore NO button click should be required (so I am not talking about a perl script in a form). I only want to call this script automatically when someone load the web page. How can I do this ? If necessary the perl script could return a value (e.g. a picture resp....
7
13446
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I am trying to set this up using asp code and IIS configuration. But it seems not working. Here it is the way I am doing. In IIS I set up a virtual directory with secure communication, I checked require secure channel, require 128-bit encryption. In custom error, instead of using default message HTTP 403.4 - Forbidden: SSL required Internet Information Services in iishelp 403.4htm, I am trying to do redirect automatically. so I...
0
937
by: allavarapu | last post by:
Hi, I am writing http protocol to get some data from servers. If i was using my localhost, getting replay from local and if want access other remote sites, i am getting error. Please reply it My localhost client script::: import httplib h = httplib.HTTP('localhost',80) h.putrequest('GET','')
1
319
by: welcomestocontact | last post by:
Hi, I am writing http protocol to get some data from servers. If i was using my localhost, getting replay from local and if want access other remote sites, i am getting error. Please reply it My localhost client script::: Code: ( python )
6
1652
by: hpatel | last post by:
Hi, I maintain a website for my organization. Recently, for a login page, I started using HTTPS. It works fine with HTTPS. The problem I face is : When a user goes to login page, he sees the login page via HTTPS. Now, if user doesn't submit the login form but chooses to browse some other link on the same page, that page will still be shown using HTTPS because links are relative. This increases unnecessary HTTPS traffic on the server.
7
1605
by: Chris | last post by:
Is there a way when a user fills out a form and it asks them to enter a website that it'll be reformatted with http:// in front of it if it isn't already there. i.e. domain.com would become http://domain.com but http://example.com would be left alone. tia, Chris
0
8610
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8902
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7740
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4623
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.