fix(card): 修复cgc卡不存在抛异常
This commit is contained in:
27
alembic/versions/2d63d72e671a_trim_card_table.py
Normal file
27
alembic/versions/2d63d72e671a_trim_card_table.py
Normal file
@@ -0,0 +1,27 @@
|
||||
"""trim card table
|
||||
|
||||
Revision ID: 2d63d72e671a
|
||||
Revises: bde4f21924c8
|
||||
Create Date: 2025-04-25 16:42:04.000778
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '2d63d72e671a'
|
||||
down_revision: Union[str, None] = 'bde4f21924c8'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column("system_cards",
|
||||
sa.Column('diy_source', sa.String(length=50), nullable=True, comment='自定义品牌名')
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
pass
|
||||
@@ -279,7 +279,7 @@ class CardScraper:
|
||||
"""CGC"""
|
||||
r = await self.api.cgc(cert_number)
|
||||
html = Selector(r.text)
|
||||
if html.xpath('//div[@class="error" and @ng-show]').get() is None:
|
||||
if html.xpath('//div[@class="certlookup-search-box"]').get() is None:
|
||||
return
|
||||
|
||||
info_elements = html.xpath('//div[@class="content-wrapper"]//dl')
|
||||
|
||||
Reference in New Issue
Block a user