Merge remote-tracking branch 'origin/main' into linnealovespie/cleanup

This commit is contained in:
2025-09-22 20:25:46 -07:00
7 changed files with 144 additions and 1 deletions

2
.gitignore vendored
View File

@ -5,3 +5,5 @@ geckodriver-*
tmp/
*.org~
data/
venv/
*~

View File

@ -24,3 +24,15 @@ Relevant but not 1-1 walkthrough of how to programmatically find building owners
[Washington State Corporations and Charities Filing Database (CCFS)](https://kingcounty.gov/en/dept/kcit/data-information-services/gis-center/property-research): For looking up a parcel owner name and finding the related business listing and related info.
TODO: Find a good source for eviction filing data. Those with access can refer to the [potential data source list](https://docs.google.com/spreadsheets/d/1Ew0UrZvP-S74velkWSKaiSGBYcxIAoRH6IGpEzNWX6s/edit?gid=0#gid=0) to find new data sources.
## Object Storage
An S3 compatible storage is hosted on [minio.radmin.live](minio.radmin.live)
SDK documentation: https://github.com/minio/minio-py/blob/master/docs/API.md
Use `lib/minio_helper.py` to extend the functionality
Run `test_minio` in `lib/main.py` to test out that it works (TODO: move this to own testing script, perhaps unit tests)
Note: You will need to have access_key and secret_key in your env before running for this to work, contact @linnealovespie or @ammaratef45 to obtain these keys)

1
lib/.empty Normal file
View File

@ -0,0 +1 @@
Well, not really empty, but it is for testing, please keep as is!

25
lib/main.py Normal file
View File

@ -0,0 +1,25 @@
from minio_helper import MinioHelper
def test_minio():
minio_helper = MinioHelper('evictorbook-seattle-data')
files_list = minio_helper.list_files()
print('listing current files stored in the bucket')
for file in files_list:
print(file)
print('adding a file then listing again')
minio_helper.upload('.empty')
files_list = minio_helper.list_files()
for file in files_list:
print(file)
print('deleting the file then listing again')
minio_helper.delete('.empty')
files_list = minio_helper.list_files()
for file in files_list:
print(file)
def main():
test_minio()
if __name__ == '__main__':
main()

30
lib/minio_helper.py Normal file
View File

@ -0,0 +1,30 @@
from minio import Minio
import io
import os
class MinioHelper:
def __init__(self, bucket_name: str):
self.client = Minio(
"minio.radmin.live",
access_key=os.environ['access_key'],
secret_key=os.environ['secret_key']
)
self.bucket_name = bucket_name
def list_files(self):
return self.client.list_objects(self.bucket_name)
def upload(self, filepath: str):
with open(filepath, "rb") as fh:
buf = io.BytesIO(fh.read())
self.client.put_object(
self.bucket_name,
filepath,
buf,
length=-1,
part_size=10*1024*1024
)
def delete(self, filepath: str):
self.client.remove_object(self.bucket_name, filepath)

View File

@ -0,0 +1,69 @@
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
# created-by: conda 25.5.1
_libgcc_mutex=0.1=main
_openmp_mutex=5.1=1_gnu
beautifulsoup4=4.13.5=py313h06a4308_0
blas=1.0=mkl
bottleneck=1.4.2=py313hf0014fa_0
brotlicffi=1.0.9.2=py313h6a678d5_1
bs4=4.13.5=py39hd3eb1b0_0
bzip2=1.0.8=h5eee18b_6
ca-certificates=2025.9.9=h06a4308_0
certifi=2025.8.3=py313h06a4308_0
cffi=2.0.0=pypi_0
charset-normalizer=3.3.2=pyhd3eb1b0_0
defusedxml=0.7.1=pyhd3eb1b0_0
expat=2.7.1=h6a678d5_0
idna=3.7=py313h06a4308_0
intel-openmp=2025.0.0=h06a4308_1171
ld_impl_linux-64=2.40=h12ee557_0
libffi=3.4.4=h6a678d5_1
libgcc-ng=11.2.0=h1234567_1
libgomp=11.2.0=h1234567_1
libmpdec=4.0.0=h5eee18b_0
libstdcxx-ng=11.2.0=h1234567_1
libuuid=1.41.5=h5eee18b_0
libxcb=1.17.0=h9b100fa_0
libzlib=1.3.1=hb25bd0a_0
mkl=2025.0.0=hacee8c2_941
mkl-service=2.4.0=py313h5eee18b_3
mkl_fft=1.3.11=py313hacdc0fc_1
mkl_random=1.2.8=py313h8928b4f_1
ncurses=6.5=h7934f7d_0
numexpr=2.11.0=py313h41d4191_1
numpy=2.3.3=py313h720eef7_0
numpy-base=2.3.3=py313h95072fd_0
odfpy=1.4.1=pyhd8ed1ab_1
openssl=3.0.17=h5eee18b_0
pandas=2.3.2=py313h280b501_0
pip=25.2=pyhc872135_0
pthread-stubs=0.3=h0ce48e5_1
pycparser=2.23=py313h06a4308_0
pysocks=1.7.1=py313h06a4308_0
python=3.13.7=h7e8bc2b_100_cp313
python-dateutil=2.9.0post0=py313h06a4308_2
python-tzdata=2025.2=pyhd3eb1b0_0
python_abi=3.13=1_cp313
pytz=2025.2=py313h06a4308_0
readline=8.3=hc2a1206_0
requests=2.32.5=py313h06a4308_0
setuptools=72.1.0=py313h06a4308_0
six=1.17.0=py313h06a4308_0
soupsieve=2.5=py313h06a4308_0
sqlite=3.50.2=hb25bd0a_1
tbb=2022.0.0=hdb19cb5_0
tbb-devel=2022.0.0=hdb19cb5_0
tk=8.6.15=h54e0aa7_0
typing-extensions=4.15.0=py313h06a4308_0
typing_extensions=4.15.0=py313h06a4308_0
tzdata=2025b=h04d1e81_0
urllib3=2.5.0=py313h06a4308_0
wheel=0.45.1=py313h06a4308_0
xorg-libx11=1.8.12=h9b100fa_1
xorg-libxau=1.0.12=h9b100fa_0
xorg-libxdmcp=1.1.5=h9b100fa_0
xorg-xorgproto=2024.1=h5eee18b_1
xz=5.6.4=h5eee18b_1
zlib=1.3.1=hb25bd0a_0

View File

@ -2,7 +2,6 @@ beautifulsoup4==4.13.5
Bottleneck==1.4.2
brotlicffi==1.0.9.2
certifi==2025.8.3
cffi==1.17.1
charset-normalizer==3.3.2
defusedxml==0.7.1
idna==3.7
@ -26,3 +25,8 @@ typing_extensions==4.15.0
tzdata==2025.2
urllib3==2.5.0
wheel==0.45.1
argon2-cffi==25.1.0
argon2-cffi-bindings==25.1.0
cffi==2.0.0
minio==7.2.16
pycryptodome==3.23.0