generated from kyegomez/Python-Package-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kye
committed
Feb 25, 2024
1 parent
5a5b49f
commit ecf2bf9
Showing
5 changed files
with
35 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" | |
|
||
[tool.poetry] | ||
name = "swarms-cloud" | ||
version = "0.1.2" | ||
version = "0.1.3" | ||
description = "Swarms Cloud - Pytorch" | ||
license = "MIT" | ||
authors = ["Kye Gomez <[email protected]>"] | ||
|
@@ -29,7 +29,7 @@ skypilot = "*" | |
torch = "*" | ||
einops = "*" | ||
pydantic = "*" | ||
|
||
stripe = "*" | ||
|
||
[tool.poetry.group.lint.dependencies] | ||
ruff = "^0.1.6" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ einops | |
tiktoken | ||
uvicorn | ||
loguru | ||
pydantic | ||
pydantic | ||
stripe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import logging | ||
|
||
import stripe | ||
from pydantic import BaseModel | ||
|
||
stripe.api_key = "your_stripe_api_key" | ||
|
||
|
||
class StripeInterface(BaseModel): | ||
customer_id: str | ||
amount: float | ||
description: str | ||
|
||
|
||
def bill_customer(customer_id: str, amount: float, description: str): | ||
try: | ||
stripe.Charge.create( | ||
customer=customer_id, | ||
amount=amount, # in cents | ||
currency="usd", | ||
description=description, | ||
) | ||
logging.info("Payment successful") | ||
except stripe.error.StripeError as e: | ||
logging.error(f"Payment failed: {str(e)}") | ||
|
||
|
||
# Usage: | ||
# bill_customer("429232323", 1000, "1,000 tokens") |