Listage des ids de toutes les stations
This commit is contained in:
		
							parent
							
								
									c80eeac919
								
							
						
					
					
						commit
						dd82e9afe9
					
				
							
								
								
									
										6
									
								
								vcub.py
								
								
								
								
							
							
						
						
									
										6
									
								
								vcub.py
								
								
								
								
							| 
						 | 
				
			
			@ -111,6 +111,9 @@ class Vcub ():
 | 
			
		|||
				return (self.id)
 | 
			
		||||
		
 | 
			
		||||
		return (Station (self.data [id], id))
 | 
			
		||||
	
 | 
			
		||||
	def get_all_ids (self):
 | 
			
		||||
		return (tuple (self.data.keys ()))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
| 
						 | 
				
			
			@ -119,4 +122,5 @@ if __name__ == '__main__':
 | 
			
		|||
		print ('%s (%d) (%f, %f)%s%s\n\tbikes: %d\n\te-bikes: %d\n\tfree: %d\n\t' % (i.name, i, i.location [0], i.location [1], i.isplus and ' (VCUB+)' or '', i.online and ' ' or ' OFFLINE', i.bikes, i.ebikes, i.empty))
 | 
			
		||||
	v = Vcub (data = get_data_from_json (vcub_url))
 | 
			
		||||
	for i in (v.get_by_id (v.get_locations () [(44.8875, -0.51763)]), ):
 | 
			
		||||
		print ('%s (%d) (%f, %f)%s%s\n\tbikes: %d\n\te-bikes: %d\n\tfree: %d\n\t' % (i.name, i, i.location [0], i.location [1], i.isplus and ' (VCUB+)' or '', i.online and ' ' or ' OFFLINE', i.bikes, i.ebikes, i.empty))
 | 
			
		||||
		print ('%s (%d) (%f, %f)%s%s\n\tbikes: %d\n\te-bikes: %d\n\tfree: %d\n\t' % (i.name, i, i.location [0], i.location [1], i.isplus and ' (VCUB+)' or '', i.online and ' ' or ' OFFLINE', i.bikes, i.ebikes, i.empty))
 | 
			
		||||
	print ('stations :', v.get_all_ids ())
 | 
			
		||||
		Loading…
	
		Reference in New Issue