Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pyfaup

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pyfaup

Python bindings for the faup library

  • 1.2
  • PyPI
  • Socket score

Maintainers
1

pyFaup - Python bindings for the Faup library


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

Examples

Example 1: Parse a URL


.. code-block:: python

		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):

.. code-block:: python

	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()

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc