
Security News
minimatch Patches 3 High-Severity ReDoS Vulnerabilities
minimatch patched three high-severity ReDoS vulnerabilities that can stall the Node.js event loop, and Socket has released free certified patches.
pyap2
Advanced tools
Pyap2 is a maintained fork of pyap, a regex-based library for parsing US, CA, and UK addresses. The fork adds typing support, handles more address formats and edge cases.
Pyap2 is a maintained fork of Pyap, a regex-based python library for detecting and parsing addresses. Currently it supports US 🇺🇸, Canadian 🇨🇦 and British 🇬🇧 addresses.
.. code-block:: python
>>> import pyap
>>> test_address = """
Lorem ipsum
225 E. John Carpenter Freeway,
Suite 1500 Irving, Texas 75062
Dorem sit amet
"""
>>> addresses = pyap.parse(test_address, country='US')
>>> for address in addresses:
# shows found address
print(address)
# shows address parts
print(address.as_dict())
...
To install Pyap2, simply:
.. code-block:: bash
$ pip install pyap2
We started improving the original pyap by adopting poetry and adding typing support.
It was extensively tested in web-scraping operations on thousands of US addresses.
Gradually, we added support for many rarer address formats and edge cases, as well
as the ability to parse a partial address where only street info is available.
Pyap should be used as a first thing when you need to detect an address inside a text when you don't know for sure whether the text contains addresses or not.
Because Pyap2 (and Pyap) is based on regular expressions it provides fast results. This is also a limitation because regexps intentionally do not use too much context to detect an address.
In other words in order to detect US address, the library doesn't use any list of US cities or a list of typical street names. It looks for a pattern which is most likely to be an address.
For example the string below would be detected as a valid address: "1 SPIRITUAL HEALER DR SHARIF NSAMBU SPECIALISING IN"
It happens because this string has all the components of a valid address: street number "1", street name "SPIRITUAL HEALER" followed by a street identifier "DR" (Drive), city "SHARIF NSAMBU SPECIALISING" and a state name abbreviation "IN" (Indiana).
The good news is that the above mentioned errors are quite rare.
FAQs
Pyap2 is a maintained fork of pyap, a regex-based library for parsing US, CA, and UK addresses. The fork adds typing support, handles more address formats and edge cases.
We found that pyap2 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
minimatch patched three high-severity ReDoS vulnerabilities that can stall the Node.js event loop, and Socket has released free certified patches.

Research
/Security News
Socket uncovered 26 malicious npm packages tied to North Korea's Contagious Interview campaign, retrieving a live 9-module infostealer and RAT from the adversary's C2.

Research
An impersonated golang.org/x/crypto clone exfiltrates passwords, executes a remote shell stager, and delivers a Rekoobe backdoor on Linux.