Compare commits

..

No commits in common. "d710dc723e9d3219dc7e062d6913d9747a3c23ff" and "980eadf588c3221be4e080f03fc72fc63e01ba4e" have entirely different histories.

5 changed files with 1 additions and 57 deletions

View File

@ -1,2 +0,0 @@
[FORMAT]
max-line-length = 120

View File

@ -1,25 +0,0 @@
# harvester/db/models.py
from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Proxy(Base):
__tablename__ = 'proxies'
id = Column(Integer, primary_key=True)
host = Column(String, nullable=False)
port = Column(Integer, nullable=False)
asn = Column(String)
egress_ip = Column(String)
egress_asn = Column(String)
date_added = Column(DateTime, nullable=False)
date_validated = Column(DateTime)
def __repr__(self):
return (
f'Proxy(id={self.id}, host={self.host}, port={self.port}, '
f'egress={self.egress}, created_at={self.created_at})'
)

View File

@ -1,28 +0,0 @@
# harvester/db/session.py
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
class SessionFactory:
def __init__(self, engine_url):
self.engine = create_engine(engine_url)
self.Session = sessionmaker(bind=self.engine)
def create_session(self):
return self.Session()
# Create a singleton instance of the SessionFactory
session_factory = None
def get_session_factory(engine_url):
global session_factory
if session_factory is None:
session_factory = SessionFactory(engine_url)
return session_factory
def get_session(engine_url):
return get_session_factory(engine_url).create_session()

View File

@ -1,3 +1,2 @@
requests requests
requests[socks] requests[socks]
sqlalchemy