Skip to content

Commit bc75768

Browse files
committed
Fix capitalization of "as" as part of a name.
1 parent e307a91 commit bc75768

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

pythonwhois/parse.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,8 +1046,10 @@ def reverse_name_comma(name):
10461046
first_segment = name_segments.pop()
10471047
return first_segment + " " + ', '.join(name_segments)
10481048

1049-
def normalize_word(word, abbreviation_threshold=4, lowercase_domains=True):
1050-
if is_known_abbreviation(word):
1049+
def normalize_word(word, abbreviation_threshold=4, lowercase_domains=True, never_abbreviations=[]):
1050+
if word.lower() in never_abbreviations:
1051+
return word.capitalize()
1052+
elif is_known_abbreviation(word):
10511053
return get_known_abbreviation(word)
10521054
elif not is_abbreviation(word, abbreviation_threshold):
10531055
return word.capitalize()
@@ -1075,7 +1077,7 @@ def normalize_name(value, abbreviation_threshold=4, length_threshold=8, lowercas
10751077
if len(words) >= 3:
10761078
# Words between the first and last
10771079
for word in words[1:-1]:
1078-
normalized_words.append(normalize_word(word, abbreviation_threshold=abbreviation_threshold, lowercase_domains=lowercase_domains))
1080+
normalized_words.append(normalize_word(word, abbreviation_threshold=abbreviation_threshold, lowercase_domains=lowercase_domains, never_abbreviations=('as',)))
10791081
if len(words) >= 2:
10801082
# Last word
10811083
normalized_words.append(normalize_word(words[-1], abbreviation_threshold=abbreviation_threshold, lowercase_domains=lowercase_domains))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"status": ["clientTransferProhibited https://www.icann.org/epp#clientTransferProhibited"], "updated_date": ["2015-03-09T06:57:22"], "contacts": {"admin": {"city": "Cottage Grove", "name": "Andrew Pietila", "state": "Minnesota", "phone": "+1.6519640898", "street": "7555\nLangley Ave S", "country": "United States", "postalcode": "55016", "organization": "Star AS A Service LLC.", "email": "[email protected]"}, "tech": {"city": "Cottage Grove", "name": "Andrew Pietila", "state": "Minnesota", "phone": "+1.6519640898", "street": "7555\nLangley Ave S", "country": "United States", "postalcode": "55016", "organization": "Star AS A Service LLC.", "email": "[email protected]"}, "registrant": {"city": "Cottage Grove", "name": "Andrew Pietila", "state": "Minnesota", "phone": "+1.6519640898", "street": "7555\nLangley Ave S", "country": "United States", "postalcode": "55016", "organization": "Star AS A Service LLC.", "email": "[email protected]"}, "billing": null}, "nameservers": ["dan.ns.cloudflare.com", "zoe.ns.cloudflare.com"], "expiration_date": ["2016-03-14T01:24:05"], "emails": ["[email protected]"], "raw": ["\n\nDomain Name: STARASASERVICE.COM\nRegistry Domain ID: 1850405869_DOMAIN_COM-VRSN\nRegistrar WHOIS Server: whois.enom.com\nRegistrar URL: www.enom.com\nUpdated Date: 2015-03-09T06:57:22.00Z\nCreation Date: 2014-03-14T01:24:00.00Z\nRegistrar Registration Expiration Date: 2016-03-14T01:24:05.00Z\nRegistrar: ENOM, INC.\nRegistrar IANA ID: 48\nReseller: NAMECHEAP.COM\nDomain Status: clientTransferProhibited https://www.icann.org/epp#clientTransferProhibited\nRegistry Registrant ID: \nRegistrant Name: ANDREW PIETILA\nRegistrant Organization: STAR AS A SERVICE LLC.\nRegistrant Street: 7555\nRegistrant Street: LANGLEY AVE S\nRegistrant City: COTTAGE GROVE\nRegistrant State/Province: MN\nRegistrant Postal Code: 55016\nRegistrant Country: US\nRegistrant Phone: +1.6519640898\nRegistrant Phone Ext: \nRegistrant Fax: \nRegistrant Fax Ext:\nRegistrant Email: [email protected]\nRegistry Admin ID: \nAdmin Name: ANDREW PIETILA\nAdmin Organization: STAR AS A SERVICE LLC.\nAdmin Street: 7555\nAdmin Street: LANGLEY AVE S\nAdmin City: COTTAGE GROVE\nAdmin State/Province: MN\nAdmin Postal Code: 55016\nAdmin Country: US\nAdmin Phone: +1.6519640898\nAdmin Phone Ext: \nAdmin Fax: \nAdmin Fax Ext:\nAdmin Email: [email protected]\nRegistry Tech ID: \nTech Name: ANDREW PIETILA\nTech Organization: STAR AS A SERVICE LLC.\nTech Street: 7555\nTech Street: LANGLEY AVE S\nTech City: COTTAGE GROVE\nTech State/Province: MN\nTech Postal Code: 55016\nTech Country: US\nTech Phone: +1.6519640898\nTech Phone Ext: \nTech Fax: \nTech Fax Ext: \nTech Email: [email protected]\nName Server: DAN.NS.CLOUDFLARE.COM\nName Server: ZOE.NS.CLOUDFLARE.COM\nDNSSEC: unSigned\nRegistrar Abuse Contact Email: [email protected]\nRegistrar Abuse Contact Phone: +1.4252982646\nURL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/\nLast update of WHOIS database: 2015-03-09T06:57:22.00Z\n\nThe data in this whois database is provided to you for information\npurposes only, that is, to assist you in obtaining information about or\nrelated to a domain name registration record. We make this information\navailable \"as is,\" and do not guarantee its accuracy. By submitting a\nwhois query, you agree that you will use this data only for lawful\npurposes and that, under no circumstances will you use this data to: (1)\nenable high volume, automated, electronic processes that stress or load\nthis whois database system providing you this information; or (2) allow,\nenable, or otherwise support the transmission of mass unsolicited,\ncommercial advertising or solicitations via direct mail, electronic\nmail, or by telephone. The compilation, repackaging, dissemination or\nother use of this data is expressly prohibited without prior written\nconsent from us. \n\nWe reserve the right to modify these terms at any time. By submitting \nthis query, you agree to abide by these terms.\nVersion 6.3 4/3/2002\n", " Domain Name: STARASASERVICE.COM\n Registrar: ENOM, INC.\n Sponsoring Registrar IANA ID: 48\n Whois Server: whois.enom.com\n Referral URL: http://www.enom.com\n Name Server: DAN.NS.CLOUDFLARE.COM\n Name Server: ZOE.NS.CLOUDFLARE.COM\n Status: clientTransferProhibited http://www.icann.org/epp#clientTransferProhibited\n Updated Date: 10-mar-2015\n Creation Date: 14-mar-2014\n Expiration Date: 14-mar-2016\n"], "whois_server": ["whois.enom.com"], "registrar": ["Enom, Inc."], "creation_date": ["2014-03-14T01:24:00"], "id": ["1850405869_DOMAIN_COM-VRSN"]}
1+
{"status": ["clientTransferProhibited https://www.icann.org/epp#clientTransferProhibited"], "updated_date": ["2015-03-09T06:57:22"], "contacts": {"admin": {"city": "Cottage Grove", "name": "Andrew Pietila", "state": "Minnesota", "phone": "+1.6519640898", "street": "7555\nLangley Ave S", "country": "United States", "postalcode": "55016", "organization": "Star As A Service LLC.", "email": "[email protected]"}, "tech": {"city": "Cottage Grove", "name": "Andrew Pietila", "state": "Minnesota", "phone": "+1.6519640898", "street": "7555\nLangley Ave S", "country": "United States", "postalcode": "55016", "organization": "Star As A Service LLC.", "email": "[email protected]"}, "registrant": {"city": "Cottage Grove", "name": "Andrew Pietila", "state": "Minnesota", "phone": "+1.6519640898", "street": "7555\nLangley Ave S", "country": "United States", "postalcode": "55016", "organization": "Star As A Service LLC.", "email": "[email protected]"}, "billing": null}, "nameservers": ["dan.ns.cloudflare.com", "zoe.ns.cloudflare.com"], "expiration_date": ["2016-03-14T01:24:05"], "emails": ["[email protected]"], "raw": ["\n\nDomain Name: STARASASERVICE.COM\nRegistry Domain ID: 1850405869_DOMAIN_COM-VRSN\nRegistrar WHOIS Server: whois.enom.com\nRegistrar URL: www.enom.com\nUpdated Date: 2015-03-09T06:57:22.00Z\nCreation Date: 2014-03-14T01:24:00.00Z\nRegistrar Registration Expiration Date: 2016-03-14T01:24:05.00Z\nRegistrar: ENOM, INC.\nRegistrar IANA ID: 48\nReseller: NAMECHEAP.COM\nDomain Status: clientTransferProhibited https://www.icann.org/epp#clientTransferProhibited\nRegistry Registrant ID: \nRegistrant Name: ANDREW PIETILA\nRegistrant Organization: STAR AS A SERVICE LLC.\nRegistrant Street: 7555\nRegistrant Street: LANGLEY AVE S\nRegistrant City: COTTAGE GROVE\nRegistrant State/Province: MN\nRegistrant Postal Code: 55016\nRegistrant Country: US\nRegistrant Phone: +1.6519640898\nRegistrant Phone Ext: \nRegistrant Fax: \nRegistrant Fax Ext:\nRegistrant Email: [email protected]\nRegistry Admin ID: \nAdmin Name: ANDREW PIETILA\nAdmin Organization: STAR AS A SERVICE LLC.\nAdmin Street: 7555\nAdmin Street: LANGLEY AVE S\nAdmin City: COTTAGE GROVE\nAdmin State/Province: MN\nAdmin Postal Code: 55016\nAdmin Country: US\nAdmin Phone: +1.6519640898\nAdmin Phone Ext: \nAdmin Fax: \nAdmin Fax Ext:\nAdmin Email: [email protected]\nRegistry Tech ID: \nTech Name: ANDREW PIETILA\nTech Organization: STAR AS A SERVICE LLC.\nTech Street: 7555\nTech Street: LANGLEY AVE S\nTech City: COTTAGE GROVE\nTech State/Province: MN\nTech Postal Code: 55016\nTech Country: US\nTech Phone: +1.6519640898\nTech Phone Ext: \nTech Fax: \nTech Fax Ext: \nTech Email: [email protected]\nName Server: DAN.NS.CLOUDFLARE.COM\nName Server: ZOE.NS.CLOUDFLARE.COM\nDNSSEC: unSigned\nRegistrar Abuse Contact Email: [email protected]\nRegistrar Abuse Contact Phone: +1.4252982646\nURL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/\nLast update of WHOIS database: 2015-03-09T06:57:22.00Z\n\nThe data in this whois database is provided to you for information\npurposes only, that is, to assist you in obtaining information about or\nrelated to a domain name registration record. We make this information\navailable \"as is,\" and do not guarantee its accuracy. By submitting a\nwhois query, you agree that you will use this data only for lawful\npurposes and that, under no circumstances will you use this data to: (1)\nenable high volume, automated, electronic processes that stress or load\nthis whois database system providing you this information; or (2) allow,\nenable, or otherwise support the transmission of mass unsolicited,\ncommercial advertising or solicitations via direct mail, electronic\nmail, or by telephone. The compilation, repackaging, dissemination or\nother use of this data is expressly prohibited without prior written\nconsent from us. \n\nWe reserve the right to modify these terms at any time. By submitting \nthis query, you agree to abide by these terms.\nVersion 6.3 4/3/2002\n", " Domain Name: STARASASERVICE.COM\n Registrar: ENOM, INC.\n Sponsoring Registrar IANA ID: 48\n Whois Server: whois.enom.com\n Referral URL: http://www.enom.com\n Name Server: DAN.NS.CLOUDFLARE.COM\n Name Server: ZOE.NS.CLOUDFLARE.COM\n Status: clientTransferProhibited http://www.icann.org/epp#clientTransferProhibited\n Updated Date: 10-mar-2015\n Creation Date: 14-mar-2014\n Expiration Date: 14-mar-2016\n"], "whois_server": ["whois.enom.com"], "registrar": ["Enom, Inc."], "creation_date": ["2014-03-14T01:24:00"], "id": ["1850405869_DOMAIN_COM-VRSN"]}

0 commit comments

Comments
 (0)