Removing sqlalchemy and the db part as it was never used
This commit is contained in:
parent
3f4be8b7ff
commit
bb2488a63b
6 changed files with 1 additions and 257 deletions
|
|
@ -1,37 +0,0 @@
|
|||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import Session
|
||||
from sqlalchemy import Column, Integer, JSON, FLOAT
|
||||
from sqlalchemy.orm import declarative_base
|
||||
|
||||
engine = create_engine("sqlite:///sqlite.db", echo=True)
|
||||
session = Session(engine)
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
|
||||
class RightmoveListing(Base):
|
||||
__tablename__ = "rightmove"
|
||||
id = Column(Integer, primary_key=True)
|
||||
price = Column(FLOAT)
|
||||
listing_json = Column(JSON, nullable=True)
|
||||
detail_json = Column(JSON, nullable=True)
|
||||
updated_timestamp = Column(Integer, nullable=True)
|
||||
lat = Column(FLOAT)
|
||||
lon = Column(FLOAT)
|
||||
distance_to_office_minutes = Column(FLOAT, nullable=True)
|
||||
|
||||
def save(self):
|
||||
session.add(self)
|
||||
session.commit()
|
||||
|
||||
def __repr__(self):
|
||||
return "<RightMoveListing(id='{}', price='{}', lat={}, lon={}')>".format(
|
||||
self.id,
|
||||
self.price,
|
||||
self.lat,
|
||||
self.lon,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
Base.metadata.create_all(engine)
|
||||
|
|
@ -2,7 +2,6 @@
|
|||
import enum
|
||||
from typing import List
|
||||
import requests
|
||||
from rec.db import RightmoveListing
|
||||
import urllib3
|
||||
|
||||
urllib3.disable_warnings()
|
||||
|
|
@ -94,23 +93,3 @@ def listing_query(
|
|||
return response.json()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
response = listing_query(
|
||||
page=1,
|
||||
min_bedrooms=2,
|
||||
max_bedrooms=2,
|
||||
radius=5.0,
|
||||
min_price=150000,
|
||||
max_price=700000,
|
||||
)
|
||||
resp = response
|
||||
for d in resp["properties"]:
|
||||
rl = RightmoveListing(
|
||||
id=d["identifier"],
|
||||
listing_json=d,
|
||||
price=d["price"],
|
||||
updated_timestamp=d["updateDate"],
|
||||
lat=d["latitude"],
|
||||
lon=d["longitude"],
|
||||
)
|
||||
rl.save()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue