john-kurkowski / tldextract

Accurately separates a URL’s subdomain, domain, and public suffix, using the Public Suffix List (PSL).
BSD 3-Clause "New" or "Revised" License
1.84k stars 210 forks source link

unexpected keyword argument 'include_psl_private_domains' #222

Closed stonecrusher closed 3 years ago

stonecrusher commented 3 years ago

Hi, python beginner here. I copied code from the readme, but the example with non-permanent setting of private domain fails with TypeError: __call__() got an unexpected keyword argument 'include_psl_private_domains'

import tldextract

# myshopify.com is a private domain listed in PSL
myURL = "test.myshopify.com"

# This works
# extract = tldextract.TLDExtract( include_psl_private_domains=True)
# ext = extract(myURL)

# This gives "unexpected keyword argument" error
extract = tldextract.TLDExtract()
ext = extract(myURL, include_psl_private_domains=True)

print(ext)

What's the issue here? Running tldextract 2.2.0 via conda-forge in Miniconda3 (4.9.2) Spyder IDE 4.2.1 Python 3.8.5

/edit Ok the first one works only as program, but the result is wrong: ExtractResult(subdomain='test', domain='myshopify', suffix='com') Considering private domains it should be ExtractResult(subdomain='', domain='test', suffix='myshopify.com')

brycedrennan commented 3 years ago

Version 2.2.0 does not support the include_psl_private_domains in the function call. You can use version >=3.1 for that functionality. You can find this information in the changelog: https://github.com/john-kurkowski/tldextract/blob/master/CHANGELOG.md

As to your second question you probably need to update you local copy of the list. You can find information in the readme file.

stonecrusher commented 3 years ago

Oh wow, I didn't consider to get such an outdated version from the package repository. Thank you for clarification! Now I have to mess with conda & pip which is everywhere discouraged to do.