Skip to content

Fix README: extract_urllib is on the TLDExtract instance, not the module - #362

Merged
john-kurkowski merged 4 commits into
john-kurkowski:masterfrom
danishashko:fix/readme-extract-urllib-example
Apr 13, 2026
Merged

Fix README: extract_urllib is on the TLDExtract instance, not the module#362
john-kurkowski merged 4 commits into
john-kurkowski:masterfrom
danishashko:fix/readme-extract-urllib-example

Conversation

@danishashko

Copy link
Copy Markdown
Contributor

The README example under "How to validate URLs before extraction" calls:

result = tldextract.extract_urllib(split_url)

But extract_urllib doesn't exist at module level. It's a method on TLDExtract instances. The module already exports extract = TLDExtract() as a ready-to-use instance, so the correct call is:

result = tldextract.extract.extract_urllib(split_url)

Running the original example raises AttributeError: module 'tldextract' has no attribute 'extract_urllib'.

@elliotwutingfeng

Copy link
Copy Markdown
Contributor

Hi, thanks for the catch, however, on 5.3.1, result = tldextract.extract.extract_urllib(split_url) did not work for me, but this does

result = tldextract.TLDExtract().extract_urllib(split_url)
# ExtractResult(subdomain='example', domain='com:8080', suffix='', is_private=False)

@john-kurkowski

Copy link
Copy Markdown
Owner

Thanks y'all!

@john-kurkowski
john-kurkowski merged commit 3858ea5 into john-kurkowski:master Apr 13, 2026
24 checks passed
john-kurkowski added a commit that referenced this pull request Apr 13, 2026
john-kurkowski added a commit that referenced this pull request Apr 13, 2026
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Aug 24, 2026
https://build.opensuse.org/request/show/1373149
by user mia + anag_factory
- Update to 5.3.2:
Bugfixes
  * Fix reverse_domain_name stray dots when suffix or domain empty
    gh#john-kurkowski/tldextract#368
Docs
  * Fix README: extract_urllib is on the instance, not the module
    gh#john-kurkowski/tldextract#362
  * Fix docstring: default cache_dir description
    gh#john-kurkowski/tldextract#367
  * Document hostname representation limits
  * Document implicit PSL wildcard behavior
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants