[Python-de] Klassen
Beate & Olaf Bee
bee_bee at t-online.de
Son Jan 4 16:43:49 CET 2004
Hallo zusammen,
erstmal Frohes Neues Jahr, ich bin der/ein Neuer.
Ich versuch mich an der OO-Programierung und hin und wieder fehlt mal
das Verständnis....
Also, ich versuche mich an der rwhois.py und kann die
Module/Functionen/Klassen auch wohl aufrufen, da sie mir
dann auch none ausgeben.
IDLE-shell
>>> import rwhois
>>> erg = DomainRecord("www.meineseite.de")
>>> print erg.created
None
>>>
Eine Internet Verbindung ist im Hintergrund geöffnet, aber ich vermute
das Python das nicht weiß?
Ich wäre für einen kleinen Tip sehr dankbar.
Grüße
Olaf Bee
P.S.: Den Kopf der rwhois.py füge ich mal an....
#! /usr/bin/python --
"""
usage: %(progname)s [domain...]
Version: %(version)s
Contacts the apropriate whois database for each domain and displays
the result.
class WhoisRecord:
self.domain -- Domain Name
self.whoisserver -- Whoisserver associated with domain
self.page -- raw whois record data
public methods:
def WhoisRecord(domain=None)
Whois object constructor
def whois(domainname=None, server=None, cache=0)
Fetches whoisrecord and places result in self.page
Raises NoSuchDomain if the domain doesn't exist.
class DomainRecord(WhoisRecord):
self.domainid -- domainid for this domain
self.created -- date in which the domain was created
self.lastupdated -- date in which the domain was last
updated.
self.expires -- date in which the domain expires
self.databaseupdated -- date in which the database was last
updated.
self.servers -- list of (hostname, ip) pairs of the
nameservers.
self.registrant -- ContactRecord of domain owner.
self.contacts -- dictionary of contacts (ContactRecord
objects)
public methods:
def DomainRecord(domain=None)
Constructor for DomainRecord
def Parse()
Creates a parsed version of the information contained in
the whois record for domain from self.page
raises NoParser if a parser does not exist for a registry.
class Contact:
self.type -- Type of contact
self.organization -- Organization associated with contact.
self.person -- Person associated with contact.
self.handle -- NIC Handle
self.address -- Street address of contact
self.address2 --
self.address3 --
self.city -- city of addr
self.state -- address state
self.zip -- zipcode
self.country -- country
self.email -- Email address of contact
self.phone -- Phone Number
self.fax -- Fax Number
self.lastupdated -- Last update of contact record
"""
_version = "1.5"
-------------- nächster Teil --------------
Ein Dateianhang mit HTML-Daten wurde geschreddert...
URL: http://starship.python.net/pipermail/python-de/attachments/20040104/7e17a904/attachment.htm