epicyon/epicyon.py

57 lines
1.4 KiB
Python
Raw Normal View History

2019-06-28 18:55:29 +00:00
__filename__ = "epicyon.py"
__author__ = "Bob Mottram"
__license__ = "AGPL3+"
__version__ = "0.0.1"
__maintainer__ = "Bob Mottram"
__email__ = "bob@freedombone.net"
__status__ = "Production"
from person import createPerson
from person import setPreferredUsername
2019-06-28 20:00:25 +00:00
from person import setBio
2019-06-28 18:55:29 +00:00
from webfinger import webfingerHandle
from posts import getUserPosts
from session import createSession
import json
import sys
import requests
from pprint import pprint
from httpsig import testHttpsig
from daemon import runDaemon
2019-06-28 19:52:35 +00:00
import socket
2019-06-28 18:55:29 +00:00
2019-06-28 20:43:37 +00:00
federationList=['mastodon.social']
2019-06-28 19:52:35 +00:00
username='testuser'
#domain=socket.gethostname()
domain='mydomain.com'
port=6227
https=True
2019-06-28 18:55:29 +00:00
useTor=False
session = createSession(useTor)
2019-06-28 19:52:35 +00:00
privateKeyPem,publicKeyPem,person,wfEndpoint=createPerson(username,domain,https,True)
setPreferredUsername(username,domain,'badger')
2019-06-28 20:00:25 +00:00
setBio(username,domain,'Some personal info')
2019-06-28 20:43:37 +00:00
runDaemon(domain,port,federationList,useTor)
2019-06-28 18:55:29 +00:00
#testHttpsig()
#sys.exit()
#pprint(person)
#print('\n')
#pprint(wfEndpoint)
handle="https://mastodon.social/@Gargron"
wfRequest = webfingerHandle(session,handle,True)
if not wfRequest:
sys.exit()
#wfResult = json.dumps(wfRequest, indent=4, sort_keys=True)
#print(str(wfResult))
#sys.exit()
maxMentions=10
maxEmoji=10
maxAttachments=5
2019-06-28 20:43:37 +00:00
userPosts = getUserPosts(session,wfRequest,2,maxMentions,maxEmoji,maxAttachments,federationList)
2019-06-28 18:55:29 +00:00
print(str(userPosts))