Skip to content

Instantly share code, notes, and snippets.

@rsyring
Created February 15, 2011 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsyring/827989 to your computer and use it in GitHub Desktop.
Save rsyring/827989 to your computer and use it in GitHub Desktop.
from isapi import isapicon, threaded_extension
import sys
import traceback
try:
from urllib import urlopen
except ImportError:
# py3k spelling...
from urllib.request import urlopen
import win32api
# sys.isapidllhandle will exist when we are loaded by the IIS framework.
# In this case we redirect our output to the win32traceutil collector.
if hasattr(sys, "isapidllhandle"):
import win32traceutil
from random import random
# The ISAPI extension - handles all requests in the site.
class Extension(threaded_extension.ThreadPoolExtension):
"Python sample Extension"
def Dispatch(self, ecb):
headers = """Content-Type: text/html\n\n"""
ecb.SendResponseHeaders("200 OK", headers, False)
ecb.WriteClient('HW from Extension Only %s' % random())
ecb.DoneWithSession()
return isapicon.HSE_STATUS_SUCCESS
# The entry points for the ISAPI extension.
def __ExtensionFactory__():
return Extension()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment