Update main.py
Browse files
main.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from fastapi import FastAPI, HTTPException
|
2 |
from pydantic import BaseModel
|
3 |
import requests
|
4 |
import random
|
@@ -18,10 +18,7 @@ app.add_middleware(
|
|
18 |
)
|
19 |
|
20 |
class CardData(BaseModel):
|
21 |
-
|
22 |
-
mes: str
|
23 |
-
ano: str
|
24 |
-
cvv: str
|
25 |
|
26 |
def generate_random_user_agent():
|
27 |
user_agents = [
|
@@ -57,10 +54,10 @@ def generate_random_address():
|
|
57 |
|
58 |
@app.post("/v1/check")
|
59 |
async def check_card(card_data: CardData):
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
|
65 |
session = requests.Session()
|
66 |
user_agent = generate_random_user_agent()
|
@@ -237,10 +234,7 @@ async def check_card(card_data: CardData):
|
|
237 |
return {
|
238 |
'status': status,
|
239 |
'response': response_text,
|
240 |
-
'card':
|
241 |
-
'mes': mes,
|
242 |
-
'ano': ano,
|
243 |
-
'cvv': cvv
|
244 |
}
|
245 |
|
246 |
except Exception as e:
|
|
|
1 |
+
from fastapi import FastAPI, HTTPException, Request
|
2 |
from pydantic import BaseModel
|
3 |
import requests
|
4 |
import random
|
|
|
18 |
)
|
19 |
|
20 |
class CardData(BaseModel):
|
21 |
+
card: str
|
|
|
|
|
|
|
22 |
|
23 |
def generate_random_user_agent():
|
24 |
user_agents = [
|
|
|
54 |
|
55 |
@app.post("/v1/check")
|
56 |
async def check_card(card_data: CardData):
|
57 |
+
try:
|
58 |
+
cc, mes, ano, cvv = card_data.card.split('|')
|
59 |
+
except ValueError:
|
60 |
+
raise HTTPException(status_code=400, detail="Invalid card format. Expected format: cc|mm|yy|cvv")
|
61 |
|
62 |
session = requests.Session()
|
63 |
user_agent = generate_random_user_agent()
|
|
|
234 |
return {
|
235 |
'status': status,
|
236 |
'response': response_text,
|
237 |
+
'card': card_data.card
|
|
|
|
|
|
|
238 |
}
|
239 |
|
240 |
except Exception as e:
|