更新代理配置
(
db: Session,
proxy_id: int,
**kwargs
)
| 590 | |
| 591 | |
| 592 | def update_proxy( |
| 593 | db: Session, |
| 594 | proxy_id: int, |
| 595 | **kwargs |
| 596 | ) -> Optional[Proxy]: |
| 597 | """更新代理配置""" |
| 598 | db_proxy = get_proxy_by_id(db, proxy_id) |
| 599 | if not db_proxy: |
| 600 | return None |
| 601 | |
| 602 | for key, value in kwargs.items(): |
| 603 | if hasattr(db_proxy, key): |
| 604 | setattr(db_proxy, key, value) |
| 605 | |
| 606 | db.commit() |
| 607 | db.refresh(db_proxy) |
| 608 | return db_proxy |
| 609 | |
| 610 | |
| 611 | def delete_proxy(db: Session, proxy_id: int) -> bool: |
nothing calls this directly
no test coverage detected