api: Fix version number check.
This fixes Trac #790. (imported from commit 4bc82ac52298308bdb7d068ed6eee740e211aa56)
This commit is contained in:
		
							parent
							
								
									cdfff24d66
								
							
						
					
					
						commit
						2c7f3a7745
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -28,6 +28,7 @@ import urlparse
 | 
			
		|||
import sys
 | 
			
		||||
import os
 | 
			
		||||
import optparse
 | 
			
		||||
from distutils.version import LooseVersion
 | 
			
		||||
 | 
			
		||||
from ConfigParser import SafeConfigParser
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -36,7 +37,7 @@ __version__ = "0.1.4"
 | 
			
		|||
 | 
			
		||||
# Check that we have a recent enough version
 | 
			
		||||
# Older versions don't provide the 'json' attribute on responses.
 | 
			
		||||
assert(requests.__version__ >= '0.12.1')
 | 
			
		||||
assert(LooseVersion(requests.__version__) >= LooseVersion('0.12.1'))
 | 
			
		||||
# In newer versions, the 'json' attribute is a function, not a property
 | 
			
		||||
requests_json_is_function = not isinstance(requests.Response.json, property)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue