Ë
    'V)j¹  ã                  ó^   — d Z ddlmZ ddlZddlmZ ddlmZ d	d„Zd
d„Z	e
dk(  r e	«        yy)zðBuild the eBay OAuth2 consent URL and print it for the user to open.

After the seller approves access, eBay redirects to the callback endpoint
which exchanges the code for tokens automatically.

Usage:
    python scripts/ebay_authorize.py
é    )ÚannotationsN)Úquote)ÚComplianceSettingsc                óœ   — d}dt        | j                  «      › dt        | j                  «      › dt        | j                  «      › �}|› d|› �S )z,Construct the eBay OAuth2 authorization URL.z&https://auth.ebay.com/oauth2/authorizez
client_id=z&redirect_uri=z&response_type=code&scope=ú?)r   Úebay_client_idÚebay_redirect_uriÚebay_oauth_scopes)ÚsettingsÚbaseÚparamss      ú9/var/www/html/agent.samochodowy/scripts/ebay_authorize.pyÚbuild_consent_urlr      s`   € à3€Dà
”U˜8×2Ñ2Ó3Ð4Ø
œ˜x×9Ñ9Ó:Ð;ðÜ˜×2Ñ2Ó3Ð4ð	6ð ð ˆV�1�V�HÐÐó    c                 ó&  — t        «       } | j                  s0t        dt        j                  ¬«       t        j
                  d«       t        | «      }t        «        t        d«       t        d«       t        d«       t        «        t        d«       t        «        t        |«       t        «        t        d«       t        d«       t        «        t        d	«       t        d
| j                  «       t        «        t        d«       t        d«       y )Nz%ERROR: EBAY_CLIENT_ID not set in .env)Úfileé   zF======================================================================u&   eBay OAuth2 â€” Autoryzacja sprzedawcyuG   OtwÃ³rz poniÅ¼szy URL w przeglÄ…darce i zaloguj siÄ™ kontem SPRZEDAWCY:z+Po zatwierdzeniu zgody eBay przekieruje na:z8  https://api.agent.dgx.dev/ebay/oauth/callback?code=...zCCallback automatycznie wymieni code na access_token + refresh_tokenzi zapisze je w:u6   Od tego momentu token bÄ™dzie odnawiany automatycznie.)r   r   ÚprintÚsysÚstderrÚexitr   Úebay_token_path)r   Úurls     r   Úmainr      s¸   € Ü!Ó#€Hà×"Ò"ÜÐ5¼C¿J¹JÕGÜ�‰�Œä
˜HÓ
%€Cä	„GÜ	ˆ(„OÜ	Ð
2Ô3Ü	ˆ(„OÜ	„GÜ	Ð
SÔTÜ	„GÜ	ˆ#„JÜ	„GÜ	Ð
7Ô8Ü	Ð
DÔEÜ	„GÜ	Ð
OÔPÜ	Ð
˜X×5Ñ5Ô6Ü	„GÜ	Ð
BÔCÜ	ˆ(…Or   Ú__main__)r   r   ÚreturnÚstr)r   ÚNone)Ú__doc__Ú
__future__r   r   Úurllib.parser   Ú%agent_samochodowy.compliance.settingsr   r   r   Ú__name__© r   r   ú<module>r%      s6   ðñõ #ã 
Ý å Dó	óð8 ˆzÒÙ…Fð r   