lyft / awspricing

Python library for AWS pricing.
Other
211 stars 53 forks source link

Getting an offer just hangs #31

Closed haxsaw closed 5 years ago

haxsaw commented 5 years ago

So I was trying the code from the README.rst and couldn't even get the initial offer object back after several minutes; the 'offer' call just hangs and I had to hit ctrl-c to get the prompt back. I tried a using the 'version' argument to try an older API version but that gave the same results. I'm using 1.1.4. I'm not really sure where to go from here.

Python 3.6.6 (default, Sep 12 2018, 18:26:19) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import awspricing
>>> ec2 = awspricing.offer("AmazonEC2")
^CTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/tom/vpy3/aws/lib/python3.6/site-packages/awspricing/__init__.py", line 95, in offer
    offer_data = _fetch_offer(service_name, version=version)
  File "/home/tom/vpy3/aws/lib/python3.6/site-packages/awspricing/__init__.py", line 81, in _fetch_offer
    resp = session.get(OFFER_BASE_URL + offer_endpoint)
  File "/home/tom/vpy3/aws/lib/python3.6/site-packages/requests/sessions.py", line 546, in get
    return self.request('GET', url, **kwargs)
  File "/home/tom/vpy3/aws/lib/python3.6/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/tom/vpy3/aws/lib/python3.6/site-packages/requests/sessions.py", line 686, in send
    r.content
  File "/home/tom/vpy3/aws/lib/python3.6/site-packages/requests/models.py", line 828, in content
    self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b''
  File "/home/tom/vpy3/aws/lib/python3.6/site-packages/requests/models.py", line 750, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "/home/tom/vpy3/aws/lib/python3.6/site-packages/urllib3/response.py", line 494, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/home/tom/vpy3/aws/lib/python3.6/site-packages/urllib3/response.py", line 442, in read
    data = self._fp.read(amt)
  File "/usr/lib/python3.6/http/client.py", line 449, in read
    n = self.readinto(b)
  File "/usr/lib/python3.6/http/client.py", line 493, in readinto
    n = self.fp.readinto(b)
  File "/usr/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.6/ssl.py", line 1009, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.6/ssl.py", line 871, in read
    return self._sslobj.read(len, buffer)
  File "/usr/lib/python3.6/ssl.py", line 631, in read
    v = self._sslobj.read(len, buffer)
KeyboardInterrupt
haxsaw commented 5 years ago

Ah, my bad; it appears that it's loading up a wodge of data and just takes a long time if the data isn't cached. I'll close this.