Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getaddrinfo failed #26

Closed
romainsuss opened this issue Jun 26, 2017 · 5 comments
Closed

getaddrinfo failed #26

romainsuss opened this issue Jun 26, 2017 · 5 comments
Labels

Comments

@romainsuss
Copy link

Hi,
When I run Depth.py I have this issue :
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):

gaierror: [Errno 11004] getaddrinfo failed

I don't understand why....

@veox
Copy link
Owner

veox commented Jun 27, 2017

OS, Python version, krakenex version?..

@romainsuss
Copy link
Author

Windows; Python 3.6; krakenex version '0.1.4' !

@veox
Copy link
Owner

veox commented Jul 2, 2017

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).

@romainsuss
Copy link
Author

romainsuss commented Jul 4, 2017

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 = {}))

@veox
Copy link
Owner

veox commented Jul 4, 2017

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).

@veox veox added invalid and removed help wanted labels Jul 4, 2017
@veox veox closed this as completed Jul 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants