mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			34 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/python
 | 
						|
import sys
 | 
						|
import os
 | 
						|
import optparse
 | 
						|
 | 
						|
usage = """get-public-streams --user=<email address> [options]
 | 
						|
 | 
						|
Prints out all the public streams in the realm.
 | 
						|
 | 
						|
Example: get-public-streams --user=tabbott@humbughq.com --site=http://127.0.0.1:8000
 | 
						|
"""
 | 
						|
parser = optparse.OptionParser(usage=usage)
 | 
						|
parser.add_option('--site',
 | 
						|
                  dest='site',
 | 
						|
                  default="https://humbughq.com",
 | 
						|
                  action='store')
 | 
						|
parser.add_option('--api-key',
 | 
						|
                  dest='api_key',
 | 
						|
                  default="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
 | 
						|
                  action='store')
 | 
						|
parser.add_option('--user',
 | 
						|
                  dest='user',
 | 
						|
                  action='store')
 | 
						|
(options, args) = parser.parse_args()
 | 
						|
 | 
						|
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
 | 
						|
import api.common
 | 
						|
client = api.common.HumbugAPI(email=options.user,
 | 
						|
                              api_key=options.api_key,
 | 
						|
                              verbose=True,
 | 
						|
                              site=options.site)
 | 
						|
 | 
						|
print client.get_public_streams()
 |