Skip to main content

Python bindings for the faup library

Project description

Faup is a URL parser, this is the Python library.

Examples

Example 1: Parse a URL

from pyfaup.faup import Faup

f = Faup()
f.decode("https://pypi.org/project/pyfaup")
print("TLD:" + f.get_tld())

This will extract all the TLDs. Replace get_tld() with get() to grab all the parsed items.

Example 2: Multithreading

Reading from a file one url per line in multiple threads (example contributed by Sebastien Larinier):

from pyfaup.faup import Faup
import threading

NUM_THREADS=5
URLS_TO_READ="your_urls_file.txt"

class ThreadFaup(threading.Thread):
    def __init__(self,list_url,f):
        self.list_url=list_url
        threading.Thread.__init__(self)
        self.f=f
    def run(self):
        for url in self.list_url:
        self.f.decode(url)
        print self.f.get()

with open(URLS_TO_READ,'r') as fd:
    for line in fd:
        line=line.replace('\r\n','')
        list_url.append(line)

f=Faup()
for i in range(0,NUM_THREADS):
    t=ThreadFaup(list_url,f)
    t.start()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyfaup-1.2.tar.gz (329.7 kB view details)

Uploaded Source

Built Distribution

pyfaup-1.2-py2.py3-none-any.whl (331.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pyfaup-1.2.tar.gz.

File metadata

  • Download URL: pyfaup-1.2.tar.gz
  • Upload date:
  • Size: 329.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.7

File hashes

Hashes for pyfaup-1.2.tar.gz
Algorithm Hash digest
SHA256 5648bc3ebd80239aec927aedfc218c3a6ff36de636cc53822bfeb70b0869b1e7
MD5 e6a6b231a397c6286ce34d8d62f574a0
BLAKE2b-256 7706189a3ddb3ec0fe02ca8dcc4e54b7183a281dc9777f3692a8f755c3b7121f

See more details on using hashes here.

File details

Details for the file pyfaup-1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: pyfaup-1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 331.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.7

File hashes

Hashes for pyfaup-1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 75f96f7da86ffb5402d3fcc2dbf98a511e792cf9100c159e34cdba8996ddc7f9
MD5 4e2598e98e3a57694f1add099fe3dba6
BLAKE2b-256 3fe75d2537be0c758ab18ec24ea303ad1a76808908e4b8a489ebafbd476c0b6a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page