Git Product home page Git Product logo

Comments (5)

romainsuss avatar romainsuss commented on May 14, 2024 1
import http.client
import urllib.request
import urllib.parse

  
class Connection:
    """Kraken.com connection handler.
  
    Public methods:
    close
    """
  
  
    def __init__(self, uri = 'api.kraken.com', timeout = 30):
        """ Create an object for reusable connections.
  
        Arguments:
        uri     -- URI to connect to (default: 'https://api.kraken.com')
        timeout -- blocking operations' timeout in seconds (default: 30)
        """
        self.headers = {
            'User-Agent': 'krakenex/0.0.3 (+https://github.com/veox/krakenex)'
        }
  
        self.conn = http.client.HTTPSConnection(uri, timeout = timeout)
        
        print('conn : ' , self.conn )
  
  
    def close(self):
        """ Close the connection.
  
        No arguments.
        """
        self.conn.close()
  
  
    def _request(self, url, req = {}, headers = {}):
        """ Send POST request to API server.
  
        url     -- Fully-qualified URL with all necessary urlencoded
                   information (string, no default)
        req     -- additional API request parameters (default: {})
        headers -- additional HTTPS headers, such as API-Key and API-Sign
                   (default: {})
        """
        data = urllib.parse.urlencode(req)
        print(data)
        headers.update(self.headers)
        self.conn.request("POST", url, data, headers)
        response = self.conn.getresponse()
  
        return response.read()
    
print(Connection()._request( 'https://api.kraken.com/0/public/Depth' , req = {}, headers = {}))

from python3-krakenex.

veox avatar veox commented on May 14, 2024

OS, Python version, krakenex version?..

from python3-krakenex.

romainsuss avatar romainsuss commented on May 14, 2024

Windows; Python 3.6; krakenex version '0.1.4' !

from python3-krakenex.

veox avatar veox commented on May 14, 2024

Never tested using on Windows, so could be Windows-specific. (EDIT: Got no resources to verify.)

Please post the full stack trace.


NB: Probably another reason to hand this off to requests (#11).

from python3-krakenex.

veox avatar veox commented on May 14, 2024

Please use three backticks for multi-line code inserts. (I've edited your post, and #28.)

What I asked for was the error message, from Traceback (most recent call last): to (and including) the final error message.

The above looks like a part of the connection module's source code - and a very old one at that (v0.0.3).

from python3-krakenex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.