added http requests for remote profiles
This commit is contained in:
parent
0b8b5ce498
commit
d9e998750c
13
microblog.py
13
microblog.py
@ -349,6 +349,8 @@ if __name__ == "__main__":
|
|||||||
import json
|
import json
|
||||||
# generate json basd on profile
|
# generate json basd on profile
|
||||||
def export_profile(post_count, last_update, config):
|
def export_profile(post_count, last_update, config):
|
||||||
|
if "profile" not in config:
|
||||||
|
return
|
||||||
if "alias" not in config["profile"] \
|
if "alias" not in config["profile"] \
|
||||||
or "url" not in config["profile"]:
|
or "url" not in config["profile"]:
|
||||||
print("Warning: no profile exported", file=sys.stderr)
|
print("Warning: no profile exported", file=sys.stderr)
|
||||||
@ -359,9 +361,20 @@ if __name__ == "__main__":
|
|||||||
"last-updated": last_update,
|
"last-updated": last_update,
|
||||||
"post-count" : post_count
|
"post-count" : post_count
|
||||||
}
|
}
|
||||||
|
if "avatar" in config["profile"]:
|
||||||
|
profile["avatar"] = config["profile"]["avatar"]
|
||||||
with open(config["file_output"], 'w') as f:
|
with open(config["file_output"], 'w') as f:
|
||||||
print(json.dumps(profile), file=f)
|
print(json.dumps(profile), file=f)
|
||||||
|
|
||||||
|
import urllib.request as http
|
||||||
|
def fetch(follow_list):
|
||||||
|
objects = []
|
||||||
|
for eceleb in follow_list:
|
||||||
|
with http.urlopen(eceleb) as response:
|
||||||
|
data = response.read()
|
||||||
|
objects.append(json.loads(data))
|
||||||
|
return objects
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
tpl, content = get_args()
|
tpl, content = get_args()
|
||||||
cfg = load_settings()
|
cfg = load_settings()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user