#!/usr/bin/env python

###
### READ ME!
###
### This is an example file to help you define a new
### server that uses the standard CGI method of accepting
### new URLs.  Just change the text in quotes as neccesary.
### If you are stumped as to what to put, then view the HTML
### source on the site's URL submission page.
###
### Copy this file to yourcoolserver.def and edit it.  Any line
### that starts with a # is a comment and will be ignored.
###

config = Configuration()

###
### CONFIGURE THIS SERVER STARTING HERE
###

# This identifying name is used throughout Pagecast
config.name = "Canada"

# standard stuff -- machine, port, and path to submission script
config.machine= "results.canada.com"
config.port=80
config.uri="/search/addurl.asp"

# this defines the 'key name' associated with the actual URL submission
config.FormQuery="addurl"  # typically q, url, or newurl 

# set this to None if an email parameter is not required by the site
# otherwise put the 'key name' for email (usual just "email")
config.EmailQuery = "email"

# any other strange hidden parameters to be passed to the remote script
config.Params = { "todo" : "add" }

# a list of strings found in the resulting HTML when the submission worked.
config.Success = ["The following URL"]

# ditto but for when the submission failed
config.Fail = ["not a valid URL", "page is no longer valid"]

# if this is defined, the logs will print the entire raw HTML that the search
# engine returns for each hit.
config.PrintAll = None  # or 1

###
### NO USER-SERVICEABLE PARTS BELOW
###

import generic, serverbase

# make sure we are using a unique name
config.name = serverbase.FindUniqueName(ServerRegister, config.name)

### Assumes ServerRegister dict in local namespace
### also assumes : class Configuration: pass

ServerRegister[config.name] = serverbase.ThreadBase(G, config.name, generic.GenericHTTP(G, config.name, config))
