Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
.. image:: https://github.com/jelford/activesoup/workflows/Build/badge.svg :target: https://github.com/jelford/activesoup/actions?query=workflow%3Abuild
.. image:: https://img.shields.io/pypi/v/activesoup.svg?maxAge=3600 :target: https://pypi.python.org/pypi?:action=display&name=activesoup
A simple library for interacting with the web from python
activesoup
combines familiar python web capabilities for convenient
headless "browsing" functionality:
requests <https://docs.python-requests.org/>
__ -
connection pooling, sessions, ...beautifulsoup <https://www.crummy.com/software/BeautifulSoup/>
__ -
convenient HTML navigation.html5lib <https://html5lib.readthedocs.org/en/latest/>
__ - parse the web
like browsers do.Full documentation can be found at https://activesoup.dev.
activesoup
aims to provide just enough functionality for basic web automation
/ crawler tasks. Consider using activesoup
when:
requests-html <https://github.com/kennethreitz/requests-html>
__selenium <http://www.seleniumhq.org/projects/webdriver/>
__ or
phantomjs <http://phantomjs.org/>
__).In the example below, we'll load a page with a simple form, enumerate the fields, and make a submission:
.. code-block:: python
>>> import activesoup
>>> # Start a session
>>> d = activesoup.Driver()
>>> page = d.get("https://httpbin.org/forms/post")
>>> # conveniently access elements, inspired by BeautifulSoup
>>> form = page.form
>>> # get the power of raw xpath search too
>>> form.find('.//input[@name="size"]')
BoundTag<input>
>>> # any element, searching by attribute
>>> form.find('.//*', name="size")
BoundTag<input>
>>> # or just search by attribute
>>> form.find(name="size")
BoundTag<input>
>>> # inspect element attributes
>>> print([i['name'] for i in form.find_all('input')])
['custname', 'custtel', 'custemail', 'size', 'size', 'size', 'topping', 'topping', 'topping', 'topping', 'delivery']
>>> # work actively with objects on the page
>>> r = form.submit({"custname": "john", "size": "small"})
>>> # responses parsed and ready based on content type
>>> r.keys()
dict_keys(['args', 'data', 'files', 'form', 'headers', 'json', 'origin', 'url'])
>>> r['form']
{'custname': 'john', 'size': 'small', 'topping': 'mushroom'}
>>> # access the underlying requests.Session too
>>> d.session
<requests.sessions.Session object at 0x7f283dc95700>
>>> # log in with cookie support
>>> d.get('https://httpbin.org/cookies/set/foo/bar')
>>> d.session.cookies['foo']
'bar'
FAQs
A pure-python headless browser
We found that activesoup demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.