Bitcoin Forum
May 03, 2024, 05:14:21 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Binance api auth ПОМОГИТЕ пожалуйста  (Read 322 times)
viktoriadevchulja (OP)
Newbie
*
Offline Offline

Activity: 15
Merit: 0


View Profile
October 23, 2020, 05:53:19 PM
 #1

Здравствуйте, решила перейти на binance, помогите пожалуйста, внесите корректировки в код, использую код битмекса для авторизации https://github.com/BitMEX/sample-market-maker/blob/master/market_maker/auth/APIKeyAuthWithExpires.py

Code:
from requests.auth import AuthBase
import time
from market_maker.auth.APIKeyAuth import generate_signature


class APIKeyAuthWithExpires(AuthBase):

    """Attaches API Key Authentication to the given Request object. This implementation uses `expires`."""

    def __init__(self, apiKey, apiSecret):
        """Init with Key & Secret."""
        self.apiKey = apiKey
        self.apiSecret = apiSecret

    def __call__(self, r):
        """
        Called when forming a request - generates api key headers. This call uses `expires` instead of nonce.
        This way it will not collide with other processes using the same API Key if requests arrive out of order.
        For more details, see https://www.bitmex.com/app/apiKeys
        """
        # modify and return the request
        expires = int(round(time.time()) + 5)  # 5s grace period in case of clock skew
        r.headers['api-expires'] = str(expires)
        r.headers['api-key'] = self.apiKey
        r.headers['api-signature'] = generate_signature(self.apiSecret, r.method, r.url, expires, r.body or '')

        return r
1714756461
Hero Member
*
Offline Offline

Posts: 1714756461

View Profile Personal Message (Offline)

Ignore
1714756461
Reply with quote  #2

1714756461
Report to moderator
The forum was founded in 2009 by Satoshi and Sirius. It replaced a SourceForge forum.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714756461
Hero Member
*
Offline Offline

Posts: 1714756461

View Profile Personal Message (Offline)

Ignore
1714756461
Reply with quote  #2

1714756461
Report to moderator
TradeJedi
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
August 28, 2022, 08:38:26 AM
 #2

Привет.

А что не так с готовым решением?

https://github.com/binance/binance-futures-connector-python
https://github.com/binance/binance-connector-python
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!