API: Disable history in the mechanize browser.
(imported from commit 8907f3af6283ab3ac72a22e936952757af56d1c3)
This commit is contained in:
		
							parent
							
								
									2e2c296899
								
							
						
					
					
						commit
						68916a228d
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		| 
						 | 
					@ -6,9 +6,14 @@ from urllib2 import HTTPError
 | 
				
			||||||
import time
 | 
					import time
 | 
				
			||||||
import traceback
 | 
					import traceback
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# TODO: Just switch to pycurl
 | 
				
			||||||
 | 
					class NoHistory(object):
 | 
				
			||||||
 | 
					    def add(self, *a, **k): pass
 | 
				
			||||||
 | 
					    def clear(self): pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class HumbugAPI():
 | 
					class HumbugAPI():
 | 
				
			||||||
    def __init__(self, email, api_key, verbose=False, site="https://app.humbughq.com"):
 | 
					    def __init__(self, email, api_key, verbose=False, site="https://app.humbughq.com"):
 | 
				
			||||||
        self.browser = mechanize.Browser()
 | 
					        self.browser = mechanize.Browser(history=NoHistory())
 | 
				
			||||||
        self.browser.set_handle_robots(False)
 | 
					        self.browser.set_handle_robots(False)
 | 
				
			||||||
        self.browser.add_password("https://app.humbughq.com/", "tabbott", "xxxxxxxxxxxxxxxxx", "wiki")
 | 
					        self.browser.add_password("https://app.humbughq.com/", "tabbott", "xxxxxxxxxxxxxxxxx", "wiki")
 | 
				
			||||||
        self.api_key = api_key
 | 
					        self.api_key = api_key
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue