gtaylor / python-route53

A simple Python 2.7/3.x compatible Route53 module. [UNMAINTAINED]
https://python-route53.readthedocs.org
MIT License
40 stars 21 forks source link

Requests Transport need status code validation #1

Closed jeanlucmongrain closed 11 years ago

jeanlucmongrain commented 11 years ago

Just an example:

> /usr/local/lib/python2.7/dist-packages/route53/transport.py(186)_send_get_request()
    185         r = requests.get(self.endpoint + path, params=params, headers=headers)
1-> 186         return r.text
    187

ipdb> print r.status_code
400
ipdb> print r.text
<?xml version="1.0"?>
<ErrorResponse xmlns="https://route53.amazonaws.com/doc/2012-02-29/"><Error><Type>Sender</Type><Code>RequestExpired</Code><Message>Request timestamp: Tue Apr 16 10:20:21 2013 expired.  It must be within 300 secs/ of server time.</Message></Error><RequestId>6132ccc8-a680-11e2-9cac-31b4847cc063</RequestId></ErrorResponse>

here what it cause:

INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): route53.amazonaws.com
DEBUG:requests.packages.urllib3.connectionpool:"GET /2012-02-29/hostedzone/xxx HTTP/1.1" 400 343
Traceback (most recent call last):
  File "/tmp/a.py", line 7, in records_exists
    hosted_zone = conn.get_hosted_zone_by_id(hosted_zone_id)
  File "/usr/local/lib/python2.7/dist-packages/route53/connection.py", line 195, in get_hosted_zone_by_id
    connection=self,
  File "/usr/local/lib/python2.7/dist-packages/route53/xml_parsers/get_hosted_zone_by_id.py", line 18, in get_hosted_zone_by_id_parser
    hosted_zone =  parse_hosted_zone(e_zone, connection)
  File "/usr/local/lib/python2.7/dist-packages/route53/xml_parsers/common_hosted_zone.py", line 34, in parse_hosted_zone
    for e_field in e_zone:
TypeError: 'NoneType' object is not iterable
gtaylor commented 11 years ago

Yikes, not sure how I missed this. Right you are, though.

gtaylor commented 11 years ago

I don't suppose I could talk you into working on this? My free time is pretty scarce right now, but this is one that probably shouldn't sit too long.

jeanlucmongrain commented 11 years ago

I can't do this right now, but I'll check that somewhere next week

OrzWTF commented 11 years ago

Same issue here.

gtaylor commented 11 years ago

Fixed in 805b698