diff --git a/README.rst b/README.rst index 01334ab..71b140f 100644 --- a/README.rst +++ b/README.rst @@ -77,7 +77,7 @@ First of all we need to receive an access token. 2. Go to the `App registration `_ page. 3. Set the application parameters. Save CLIENT_ID and YOUR_REDIRECT_URI for net steps 4. Click the Confirm button. -5. Paste CLIENT_ID and REDIRECT_URI insted of YOUR_CLIENT_ID and YOUR_REDIRECT_URI. Choose scopes and run code. +5. Paste CLIENT_ID, REDIRECT_URI and CLIENT_SECRET insted of YOUR_CLIENT_ID, YOUR_REDIRECT_URI and YOUR_CLIENT_SECRET. Choose scopes and run code. 6. Follow all steps from the program. .. code:: python @@ -87,6 +87,7 @@ First of all we need to receive an access token. Authorize( client_id="YOUR_CLIENT_ID", redirect_uri="YOUR_REDIRECT_URI", + client_secret="YOUR_CLIENT_SECRET", scope=["account-info", "operation-history", "operation-details", diff --git a/examples/authorize.py b/examples/authorize.py index 3855854..c6f6c70 100644 --- a/examples/authorize.py +++ b/examples/authorize.py @@ -3,11 +3,12 @@ Authorize( client_id="YOUR_CLIENT_ID", redirect_uri="YOUR_REDIRECT_URI", + client_secret="YOUR_CLIENT_SECRET", scope=["account-info", - "operation-history", - "operation-details", - "incoming-transfers", - "payment-p2p", - "payment-shop", - ] - ) + "operation-history", + "operation-details", + "incoming-transfers", + "payment-p2p", + "payment-shop", + ] +) diff --git a/examples/history.py b/examples/history.py index 79a6e86..05acfa6 100644 --- a/examples/history.py +++ b/examples/history.py @@ -20,4 +20,3 @@ print("\tAmount -->", operation.amount) print("\tLabel -->", operation.label) print("\tType -->", operation.type) - diff --git a/examples/operation_details.py b/examples/operation_details.py index 8f2209a..99fd5fa 100644 --- a/examples/operation_details.py +++ b/examples/operation_details.py @@ -11,4 +11,4 @@ max_size = len(max(properties, key=len)) for prop in properties: - print(prop, " " * (max_size - len(prop)), "-->", str(details.__getattribute__(prop)).replace('\n', ' ')) \ No newline at end of file + print(prop, " " * (max_size - len(prop)), "-->", str(details.__getattribute__(prop)).replace('\n', ' ')) diff --git a/examples/quickpay.py b/examples/quickpay.py index 3fd7d45..bdb4d5c 100644 --- a/examples/quickpay.py +++ b/examples/quickpay.py @@ -1,12 +1,12 @@ from yoomoney import Quickpay quickpay = Quickpay( - receiver="410019014512803", - quickpay_form="shop", - targets="Sponsor this project", - paymentType="SB", - sum=150, - ) + receiver="410019014512803", + quickpay_form="shop", + targets="Sponsor this project", + paymentType="SB", + sum=150, +) print(quickpay.base_url) -print(quickpay.redirected_url) \ No newline at end of file +print(quickpay.redirected_url) diff --git a/yoomoney/authorize/authorize.py b/yoomoney/authorize/authorize.py index 2421b8e..a851ff9 100644 --- a/yoomoney/authorize/authorize.py +++ b/yoomoney/authorize/authorize.py @@ -6,13 +6,14 @@ UnauthorizedClient, InvalidGrant, EmptyToken - ) +) class Authorize: def __init__( self, client_id: str, redirect_uri: str, + client_secret: str, scope: List[str] ): @@ -39,11 +40,7 @@ def __init__( pass url = "https://yoomoney.ru/oauth/token?code={code}&client_id={client_id}&" \ - "grant_type=authorization_code&redirect_uri={redirect_uri}".format(code=str(code), - client_id=client_id, - redirect_uri=redirect_uri, - ) - + "grant_type=authorization_code&redirect_uri={redirect_uri}&client_secret={client_secret}".format(code=str(code), client_id=client_id, redirect_uri=redirect_uri, client_secret=client_secret ) response = requests.request("POST", url, headers=headers) if "error" in response.json():