mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-11-04 03:03:18 -05:00 
			
		
		
		
	
		
			
	
	
		
			27 lines
		
	
	
		
			499 B
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			27 lines
		
	
	
		
			499 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| 
								 | 
							
								import json
							 | 
						||
| 
								 | 
							
								from pathlib import Path
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import requests
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								CWD = Path(__file__).parent
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								def login(username="changeme@email.com", password="MyPassword"):
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    payload = {"username": username, "password": password}
							 | 
						||
| 
								 | 
							
								    r = requests.post("http://localhost:9000/api/auth/token", payload)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    # Bearer
							 | 
						||
| 
								 | 
							
								    token = json.loads(r.text).get("access_token")
							 | 
						||
| 
								 | 
							
								    return {"Authorization": f"Bearer {token}"}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								def main():
							 | 
						||
| 
								 | 
							
								    print("Starting...")
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    print("Finished...")
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								if __name__ == "__main__":
							 | 
						||
| 
								 | 
							
								    main()
							 |