mirror of
				https://github.com/robweber/xbmcbackup.git
				synced 2025-11-04 03:02:16 +01:00 
			
		
		
		
	add tinyurl library and
This commit is contained in:
		
							
								
								
									
										11
									
								
								resources/lib/tinyurl.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								resources/lib/tinyurl.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					import urllib2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#this is duplicated in snipppets of code from all over the web, credit to no one
 | 
				
			||||||
 | 
					#in particular - to all those that have gone before me!
 | 
				
			||||||
 | 
					def shorten(aUrl):
 | 
				
			||||||
 | 
					    tinyurl = 'http://tinyurl.com/api-create.php?url='
 | 
				
			||||||
 | 
					    req = urllib2.urlopen(tinyurl + aUrl)
 | 
				
			||||||
 | 
					    data = req.read()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    #should be a tiny url
 | 
				
			||||||
 | 
					    return str(data)
 | 
				
			||||||
		Reference in New Issue
	
	Block a user