1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/fdff233d2fc6/ Changeset: fdff233d2fc6 User: greg Date: 2014-06-08 14:45:16 Summary: More fixes for handling 307 redirects not being handled nicely by urllib2.urlopen() when the urllib2.Request has data provided. Affected #: 1 file diff -r a932242dc2da4fd532c640006aa2ae4d35a7d72b -r fdff233d2fc6b10c31a613bd60cd1f42ff1a1113 lib/tool_shed/scripts/api/common.py --- a/lib/tool_shed/scripts/api/common.py +++ b/lib/tool_shed/scripts/api/common.py @@ -18,6 +18,9 @@ """ try: url = make_url( url, api_key=api_key, args=None ) + # Fix for handling 307 redirect not being handled nicely by urllib2.urlopen when the + # urllib2.Request has data provided. + url = urllib2.urlopen( urllib2.Request( url ) ).geturl() req = urllib2.Request( url, headers = { 'Content-Type': 'application/json' }, data = json.dumps( data )) req.get_method = lambda: 'DELETE' r = json.loads( urllib2.urlopen( req ).read() ) @@ -174,12 +177,18 @@ def post( url, data, api_key=None ): """Do the POST.""" url = make_url( url, api_key=api_key, args=None ) + # Fix for handling 307 redirect not being handled nicely by urllib2.urlopen when the + # urllib2.Request has data provided. + url = urllib2.urlopen( urllib2.Request( url ) ).geturl() req = urllib2.Request( url, headers = { 'Content-Type': 'application/json' }, data = json.dumps( data ) ) return json.loads( urllib2.urlopen( req ).read() ) def put( url, data, api_key=None ): """Do the PUT.""" url = make_url( url, api_key=api_key, args=None ) + # Fix for handling 307 redirect not being handled nicely by urllib2.urlopen when the + # urllib2.Request has data provided. + url = urllib2.urlopen( urllib2.Request( url ) ).geturl() req = urllib2.Request( url, headers = { 'Content-Type': 'application/json' }, data = json.dumps( data )) req.get_method = lambda: 'PUT' return json.loads( urllib2.urlopen( req ).read() ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.