Spaces:
Runtime error
Runtime error
externalize the endpoint definition
Browse files- .env.example +1 -0
- dags/new_transaction.py +2 -1
.env.example
CHANGED
|
@@ -13,3 +13,4 @@ DATABASE_URL=
|
|
| 13 |
|
| 14 |
# Fraud production endpoint
|
| 15 |
TRANSACTION_PRODUCER_ENDPOINT=https://charlestng-real-time-fraud-detection.hf.space/current-transactions
|
|
|
|
|
|
| 13 |
|
| 14 |
# Fraud production endpoint
|
| 15 |
TRANSACTION_PRODUCER_ENDPOINT=https://charlestng-real-time-fraud-detection.hf.space/current-transactions
|
| 16 |
+
TRANSACTION_CONSUMER_ENDPOINT=
|
dags/new_transaction.py
CHANGED
|
@@ -20,6 +20,7 @@ load_dotenv()
|
|
| 20 |
|
| 21 |
DEFAULT_TRANSACTION_PRODUCER_ENDPOINT = "https://charlestng-real-time-fraud-detection.hf.space/current-transactions"
|
| 22 |
TRANSACTION_PRODUCER_ENDPOINT = os.getenv("TRANSACTION_PRODUCER_ENDPOINT", DEFAULT_TRANSACTION_PRODUCER_ENDPOINT)
|
|
|
|
| 23 |
|
| 24 |
@task(task_id="pull_transaction")
|
| 25 |
def _pull_transaction(ti, prefix: str = ''):
|
|
@@ -103,7 +104,7 @@ def _push_transaction(ti, prefix: str = ''):
|
|
| 103 |
headers['Authorization'] = TRANSACTION_CONSUMER_API_KEY
|
| 104 |
|
| 105 |
api_response = requests.post(
|
| 106 |
-
url=
|
| 107 |
data=json.dumps(data),
|
| 108 |
headers=headers,
|
| 109 |
)
|
|
|
|
| 20 |
|
| 21 |
DEFAULT_TRANSACTION_PRODUCER_ENDPOINT = "https://charlestng-real-time-fraud-detection.hf.space/current-transactions"
|
| 22 |
TRANSACTION_PRODUCER_ENDPOINT = os.getenv("TRANSACTION_PRODUCER_ENDPOINT", DEFAULT_TRANSACTION_PRODUCER_ENDPOINT)
|
| 23 |
+
TRANSACTION_CONSUMER_ENDPOINT = os.getenv("TRANSACTION_CONSUMER_ENDPOINT")
|
| 24 |
|
| 25 |
@task(task_id="pull_transaction")
|
| 26 |
def _pull_transaction(ti, prefix: str = ''):
|
|
|
|
| 104 |
headers['Authorization'] = TRANSACTION_CONSUMER_API_KEY
|
| 105 |
|
| 106 |
api_response = requests.post(
|
| 107 |
+
url=TRANSACTION_CONSUMER_ENDPOINT,
|
| 108 |
data=json.dumps(data),
|
| 109 |
headers=headers,
|
| 110 |
)
|