Initial commit — PlantGuideScraper project
This commit is contained in:
18
backend/app/models/api_key.py
Normal file
18
backend/app/models/api_key.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from sqlalchemy import Column, Integer, String, Float, Boolean
|
||||
|
||||
from app.database import Base
|
||||
|
||||
|
||||
class ApiKey(Base):
|
||||
__tablename__ = "api_keys"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
source = Column(String, unique=True, nullable=False) # 'flickr', 'inaturalist', 'wikimedia', 'trefle'
|
||||
api_key = Column(String, nullable=False) # Also used as Client ID for OAuth sources
|
||||
api_secret = Column(String, nullable=True) # Also used as Client Secret for OAuth sources
|
||||
access_token = Column(String, nullable=True) # For OAuth sources like Wikimedia
|
||||
rate_limit_per_sec = Column(Float, default=1.0)
|
||||
enabled = Column(Boolean, default=True)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<ApiKey(id={self.id}, source='{self.source}', enabled={self.enabled})>"
|
||||
Reference in New Issue
Block a user