wilmars commited on
Commit
f7252af
1 Parent(s): 2cf8e50

Not using async

Browse files
Files changed (1) hide show
  1. api/main.py +5 -2
api/main.py CHANGED
@@ -1,16 +1,19 @@
 
1
  from fastapi import FastAPI
2
- from src.extraction import main
3
  from pydantic import BaseModel, Field
4
 
5
  app = FastAPI()
6
 
7
  class Product(BaseModel):
8
  product: str = Field("Producto a buscar", example = "carros")
 
9
 
10
  @app.post("/product")
11
  async def get_data(product: Product):
12
  print(product)
13
- data = await main(product.product)
 
14
  return data
15
 
16
  @app.get("/heart-beat")
 
1
+ from typing import Union
2
  from fastapi import FastAPI
3
+ from src.extraction_normal import main
4
  from pydantic import BaseModel, Field
5
 
6
  app = FastAPI()
7
 
8
  class Product(BaseModel):
9
  product: str = Field("Producto a buscar", example = "carros")
10
+ pages: Union[int, str] = Field("Number of pages to scrape", example = "all")
11
 
12
  @app.post("/product")
13
  async def get_data(product: Product):
14
  print(product)
15
+ data = main(product=product.product,
16
+ pages= product.pages)
17
  return data
18
 
19
  @app.get("/heart-beat")