22 lines
		
	
	
		
			705 B
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			22 lines
		
	
	
		
			705 B
		
	
	
	
		
			Python
		
	
	
	
	
	
|  | from lunduke.client import DiscourseClient | ||
|  | from lunduke.forum.mappings import Categories | ||
|  | 
 | ||
|  | def main(): | ||
|  |     client = DiscourseClient() | ||
|  |     category_ids = Categories().get_all().keys() | ||
|  |     # https://{defaultHost}/c/{id}/show.json | ||
|  |     # TODO: FAILS: 403 - The API KEY DOES NOT ACKNOWLEDGE THAT I AM LOGGED IN | ||
|  |     for cat_id in category_ids: | ||
|  |             try: | ||
|  |                 response = client.get(f"/c/{cat_id}/show.json") | ||
|  |                 print(response.request.url) | ||
|  |                 print(response.request.headers) | ||
|  |                 print(response.status_code) | ||
|  |                 print(response.json()) | ||
|  |             except Exception as e: | ||
|  |                 print(f"Error: {e}") | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | if __name__ == "__main__": | ||
|  |     main() |