simplified export_profile()
This commit is contained in:
		
							parent
							
								
									9fbdf2a8a7
								
							
						
					
					
						commit
						de78ad42b8
					
				
							
								
								
									
										18
									
								
								microblog.py
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								microblog.py
									
									
									
									
									
								
							| @ -353,25 +353,17 @@ if __name__ == "__main__": | ||||
|         return s | ||||
| 
 | ||||
|     import json | ||||
|     # generate json basd on profile  | ||||
|     def export_profile(post_count, last_update, config): | ||||
|         if "profile" not in config: | ||||
|             return | ||||
|         if "username" not in config["profile"] \ | ||||
|         or "url" not in config["profile"]: | ||||
|         p = config["profile"] | ||||
|         p["post-count"] = post_count | ||||
|         p["last-updated"] = last_update | ||||
|         if "username" not in p or "url" not in p: | ||||
|             print("Warning: no profile exported", file=sys.stderr) | ||||
|             return | ||||
|         profile = { | ||||
|             "username" : config["profile"]["username"], | ||||
|             "url": config["profile"]["url"], | ||||
|             "last-updated": last_update, | ||||
|             "short-bio" : config["profile"]["short_bio"], | ||||
|             "post-count" : post_count | ||||
|         } | ||||
|         if "avatar" in config["profile"]:  | ||||
|             profile["avatar"] = config["profile"]["avatar"] | ||||
|         with open(config["file_output"], 'w') as f: | ||||
|             print(json.dumps(profile), file=f) | ||||
|             print(json.dumps(p), file=f) | ||||
| 
 | ||||
|     def fn1(webring_config):    # come up with better name later/ | ||||
|         import pycurl | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user