diff --git a/daemon.py b/daemon.py index 096888e29..cd8b5f9ed 100644 --- a/daemon.py +++ b/daemon.py @@ -21,7 +21,7 @@ import pyqrcode from hashlib import sha256 from hashlib import md5 from shutil import copyfile -from session import createSession +from session import create_session from webfinger import webfingerMeta from webfinger import webfingerNodeInfo from webfinger import webfingerLookup @@ -701,7 +701,7 @@ class PubServer(BaseHTTPRequestHandler): if self.server.session: return True print('DEBUG: creating new session during ' + callingFunction) - self.server.session = createSession(self.server.proxy_type) + self.server.session = create_session(self.server.proxy_type) if self.server.session: return True print('ERROR: GET failed to create session during ' + @@ -17477,7 +17477,7 @@ class PubServer(BaseHTTPRequestHandler): if not self._establishSession("POST"): fitnessPerformance(POSTstartTime, self.server.fitness, - '_POST', 'createSession', + '_POST', 'create_session', self.server.debug) self._404() return diff --git a/desktop_client.py b/desktop_client.py index 76513e633..da5b9a84e 100644 --- a/desktop_client.py +++ b/desktop_client.py @@ -26,7 +26,7 @@ from utils import get_nickname_from_actor from utils import get_domain_from_actor from utils import is_pgp_encrypted from utils import local_actor_url -from session import createSession +from session import create_session from speaker import speakableText from speaker import getSpeakerPitch from speaker import getSpeakerRate @@ -1403,7 +1403,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, sayStr = indent + 'Connecting...' _sayCommand(sayStr, sayStr, screenreader, system_language, espeak) - session = createSession(proxy_type) + session = create_session(proxy_type) sayStr = indent + '/q or /quit to exit' _sayCommand(sayStr, sayStr, screenreader, @@ -1501,7 +1501,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, desktopShown = True prevTimelineFirstId = timelineFirstId else: - session = createSession(proxy_type) + session = create_session(proxy_type) if not desktopShown: if not session: print('No session\n') @@ -1728,7 +1728,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, if post_json_object['object'].get('conversation'): conversationId = \ post_json_object['object']['conversation'] - sessionReply = createSession(proxy_type) + sessionReply = create_session(proxy_type) _desktopReplyToPost(sessionReply, post_id, base_dir, nickname, password, domain, port, http_prefix, @@ -1747,7 +1747,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, commandStr.startswith('direct message ') or commandStr.startswith('post ') or commandStr.startswith('send ')): - sessionPost = createSession(proxy_type) + sessionPost = create_session(proxy_type) if commandStr.startswith('dm ') or \ commandStr.startswith('direct message ') or \ commandStr.startswith('post ') or \ @@ -1806,7 +1806,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, _sayCommand(sayStr, sayStr, screenreader, system_language, espeak) - sessionLike = createSession(proxy_type) + sessionLike = create_session(proxy_type) sendLikeViaServer(base_dir, sessionLike, nickname, password, domain, port, http_prefix, @@ -1845,7 +1845,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, _sayCommand(sayStr, sayStr, screenreader, system_language, espeak) - sessionMute = createSession(proxy_type) + sessionMute = create_session(proxy_type) sendUndoMuteViaServer(base_dir, sessionMute, nickname, password, domain, port, @@ -1877,7 +1877,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, _sayCommand(sayStr, sayStr, screenreader, system_language, espeak) - sessionMute = createSession(proxy_type) + sessionMute = create_session(proxy_type) sendMuteViaServer(base_dir, sessionMute, nickname, password, domain, port, @@ -1918,7 +1918,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, _sayCommand(sayStr, sayStr, screenreader, system_language, espeak) - sessionbm = createSession(proxy_type) + sessionbm = create_session(proxy_type) sendUndoBookmarkViaServer(base_dir, sessionbm, nickname, password, domain, port, http_prefix, @@ -1949,7 +1949,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, _sayCommand(sayStr, sayStr, screenreader, system_language, espeak) - sessionbm = createSession(proxy_type) + sessionbm = create_session(proxy_type) sendBookmarkViaServer(base_dir, sessionbm, nickname, password, domain, port, http_prefix, @@ -1983,7 +1983,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, _sayCommand(sayStr, sayStr, screenreader, system_language, espeak) - sessionBlock = createSession(proxy_type) + sessionBlock = create_session(proxy_type) sendUndoBlockViaServer(base_dir, sessionBlock, nickname, password, domain, port, @@ -2030,7 +2030,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, _sayCommand(sayStr, sayStr, screenreader, system_language, espeak) - sessionBlock = createSession(proxy_type) + sessionBlock = create_session(proxy_type) sendBlockViaServer(base_dir, sessionBlock, nickname, password, domain, port, @@ -2061,7 +2061,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, _sayCommand(sayStr, sayStr, screenreader, system_language, espeak) - sessionUnlike = createSession(proxy_type) + sessionUnlike = create_session(proxy_type) sendUndoLikeViaServer(base_dir, sessionUnlike, nickname, password, domain, port, http_prefix, @@ -2092,7 +2092,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, _sayCommand(sayStr, sayStr, screenreader, system_language, espeak) - sessionAnnounce = createSession(proxy_type) + sessionAnnounce = create_session(proxy_type) sendAnnounceViaServer(base_dir, sessionAnnounce, nickname, password, domain, port, @@ -2125,7 +2125,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, _sayCommand(sayStr, sayStr, screenreader, system_language, espeak) - sessionAnnounce = createSession(proxy_type) + sessionAnnounce = create_session(proxy_type) sendUndoAnnounceViaServer(base_dir, sessionAnnounce, post_json_object, nickname, password, @@ -2220,7 +2220,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, followNickname + '@' + followDomain _sayCommand(sayStr, sayStr, screenreader, system_language, espeak) - sessionFollow = createSession(proxy_type) + sessionFollow = create_session(proxy_type) sendFollowRequestViaServer(base_dir, sessionFollow, nickname, password, @@ -2256,7 +2256,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, followNickname + '@' + followDomain _sayCommand(sayStr, sayStr, screenreader, system_language, espeak) - sessionUnfollow = createSession(proxy_type) + sessionUnfollow = create_session(proxy_type) sendUnfollowRequestViaServer(base_dir, sessionUnfollow, nickname, password, domain, port, @@ -2287,7 +2287,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, approveNickname + '@' + approveDomain _sayCommand(sayStr, sayStr, screenreader, system_language, espeak) - sessionApprove = createSession(proxy_type) + sessionApprove = create_session(proxy_type) approveFollowRequestViaServer(base_dir, sessionApprove, nickname, password, domain, port, @@ -2320,7 +2320,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, denyNickname + '@' + denyDomain _sayCommand(sayStr, sayStr, screenreader, system_language, espeak) - sessionDeny = createSession(proxy_type) + sessionDeny = create_session(proxy_type) denyFollowRequestViaServer(base_dir, sessionDeny, nickname, password, domain, port, @@ -2495,7 +2495,7 @@ def runDesktopClient(base_dir: str, proxy_type: str, http_prefix: str, _sayCommand(sayStr, sayStr, screenreader, system_language, espeak) - sessionrm = createSession(proxy_type) + sessionrm = create_session(proxy_type) sendDeleteViaServer(base_dir, sessionrm, nickname, password, domain, port, diff --git a/epicyon.py b/epicyon.py index 80e112725..afcb2dc71 100644 --- a/epicyon.py +++ b/epicyon.py @@ -41,7 +41,7 @@ from posts import sendPostViaServer from posts import getPublicPostsOfPerson from posts import getUserUrl from posts import checkDomains -from session import createSession +from session import create_session from session import getJson from session import downloadHtml from newswire import getRSS @@ -934,7 +934,7 @@ if args.postsraw: sys.exit() if args.json: - session = createSession(None) + session = create_session(None) profileStr = 'https://www.w3.org/ns/activitystreams' asHeader = { 'Accept': 'application/ld+json; profile="' + profileStr + '"' @@ -958,7 +958,7 @@ if args.json: sys.exit() if args.htmlpost: - session = createSession(None) + session = create_session(None) profileStr = 'https://www.w3.org/ns/activitystreams' asHeader = { 'Accept': 'text/html; profile="' + profileStr + '"' @@ -1044,7 +1044,7 @@ if args.domain: set_config_param(base_dir, 'domain', domain) if args.rss: - session = createSession(None) + session = create_session(None) testRSS = getRSS(base_dir, domain, session, args.rss, False, False, 1000, 1000, 1000, 1000, debug) pprint(testRSS) @@ -1182,7 +1182,7 @@ if args.approve: if '@' not in args.approve: print('syntax: --approve nick@domain') sys.exit() - session = createSession(proxy_type) + session = create_session(proxy_type) send_threads = [] postLog = [] cached_webfingers = {} @@ -1210,7 +1210,7 @@ if args.deny: if '@' not in args.deny: print('syntax: --deny nick@domain') sys.exit() - session = createSession(proxy_type) + session = create_session(proxy_type) send_threads = [] postLog = [] cached_webfingers = {} @@ -1261,7 +1261,7 @@ if args.message: sys.exit() args.password = args.password.replace('\n', '') - session = createSession(proxy_type) + session = create_session(proxy_type) if not args.sendto: print('Specify an account to sent to: --sendto [nickname@domain]') sys.exit() @@ -1343,7 +1343,7 @@ if args.announce: sys.exit() args.password = args.password.replace('\n', '') - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} if not domain: @@ -1396,7 +1396,7 @@ if args.box: if args.secure_mode: signing_priv_key_pem = getInstanceActorKey(base_dir, domain) - session = createSession(proxy_type) + session = create_session(proxy_type) boxJson = c2sBoxJson(base_dir, session, args.nickname, args.password, domain, port, http_prefix, @@ -1448,7 +1448,7 @@ if args.itemName: 'with the --duration option') sys.exit() - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} if not domain: @@ -1491,7 +1491,7 @@ if args.undoItemName: print('Specify a nickname with the --nickname option') sys.exit() - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} if not domain: @@ -1553,7 +1553,7 @@ if args.wantedItemName: 'with the --duration option') sys.exit() - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} if not domain: @@ -1596,7 +1596,7 @@ if args.undoWantedItemName: print('Specify a nickname with the --nickname option') sys.exit() - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} if not domain: @@ -1630,7 +1630,7 @@ if args.like: sys.exit() args.password = args.password.replace('\n', '') - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} if not domain: @@ -1669,7 +1669,7 @@ if args.react: sys.exit() args.password = args.password.replace('\n', '') - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} if not domain: @@ -1702,7 +1702,7 @@ if args.undolike: sys.exit() args.password = args.password.replace('\n', '') - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} if not domain: @@ -1742,7 +1742,7 @@ if args.undoreact: sys.exit() args.password = args.password.replace('\n', '') - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} if not domain: @@ -1776,7 +1776,7 @@ if args.bookmark: sys.exit() args.password = args.password.replace('\n', '') - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} if not domain: @@ -1810,7 +1810,7 @@ if args.unbookmark: sys.exit() args.password = args.password.replace('\n', '') - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} if not domain: @@ -1843,7 +1843,7 @@ if args.delete: sys.exit() args.password = args.password.replace('\n', '') - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} if not domain: @@ -1885,7 +1885,7 @@ if args.follow: sys.exit() followDomain, followPort = get_domain_from_actor(args.follow) - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} followHttpPrefix = http_prefix @@ -1931,7 +1931,7 @@ if args.unfollow: sys.exit() followDomain, followPort = get_domain_from_actor(args.unfollow) - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} followHttpPrefix = http_prefix @@ -1968,7 +1968,7 @@ if args.followingList: sys.exit() args.password = args.password.replace('\n', '') - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} followHttpPrefix = http_prefix @@ -2001,7 +2001,7 @@ if args.followersList: sys.exit() args.password = args.password.replace('\n', '') - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} followHttpPrefix = http_prefix @@ -2035,7 +2035,7 @@ if args.followRequestsList: sys.exit() args.password = args.password.replace('\n', '') - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} followHttpPrefix = http_prefix @@ -2090,7 +2090,7 @@ if args.migrations: else: http_prefix = 'https' port = 443 - session = createSession(proxy_type) + session = create_session(proxy_type) if not domain: domain = get_config_param(base_dir, 'domain') signing_priv_key_pem = None @@ -2187,7 +2187,7 @@ if args.followers: else: http_prefix = 'https' port = 443 - session = createSession(proxy_type) + session = create_session(proxy_type) if nickname == 'inbox': nickname = domain @@ -2496,7 +2496,7 @@ if args.skill: print('Skill level should be a percentage in the range 0-100') sys.exit() - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} if not domain: @@ -2531,7 +2531,7 @@ if args.availability: sys.exit() args.password = args.password.replace('\n', '') - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} if not domain: @@ -2645,7 +2645,7 @@ if args.block: print(args.block + ' does not look like an actor url') sys.exit() - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} if not domain: @@ -2677,7 +2677,7 @@ if args.mute: sys.exit() args.password = args.password.replace('\n', '') - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} if not domain: @@ -2709,7 +2709,7 @@ if args.unmute: sys.exit() args.password = args.password.replace('\n', '') - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} if not domain: @@ -2753,7 +2753,7 @@ if args.unblock: print(args.unblock + ' does not look like an actor url') sys.exit() - session = createSession(proxy_type) + session = create_session(proxy_type) person_cache = {} cached_webfingers = {} if not domain: diff --git a/inbox.py b/inbox.py index 2da76c390..1ac625d5b 100644 --- a/inbox.py +++ b/inbox.py @@ -65,7 +65,7 @@ from categories import getHashtagCategories from categories import setHashtagCategory from httpsig import getDigestAlgorithmFromHeaders from httpsig import verifyPostHeaders -from session import createSession +from session import create_session from follow import followerApprovalActive from follow import isFollowingActor from follow import getFollowersOfActor @@ -4106,7 +4106,7 @@ def runInboxQueue(recent_posts_cache: {}, max_recent_posts: int, currSessionTime = int(time.time()) session_last_update = currSessionTime print('Starting new session when starting inbox queue') - session = createSession(proxy_type) + session = create_session(proxy_type) inboxHandle = 'inbox@' + domain if debug: print('DEBUG: Inbox queue running') @@ -4164,7 +4164,7 @@ def runInboxQueue(recent_posts_cache: {}, max_recent_posts: int, # recreate the session periodically if not session or curr_time - session_last_update > 21600: print('Regenerating inbox queue session at 6hr interval') - session = createSession(proxy_type) + session = create_session(proxy_type) if not session: continue session_last_update = curr_time diff --git a/newsdaemon.py b/newsdaemon.py index 9ce35e0de..94fad6c5b 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -35,7 +35,7 @@ from utils import clear_from_post_caches from utils import dangerous_markup from utils import local_actor_url from inbox import storeHashTags -from session import createSession +from session import create_session def _updateFeedsOutboxIndex(base_dir: str, domain: str, post_id: str) -> None: @@ -785,7 +785,7 @@ def runNewswireDaemon(base_dir: str, httpd, # has the session been created yet? if not httpd.session: print('Newswire daemon waiting for session') - httpd.session = createSession(httpd.proxy_type) + httpd.session = create_session(httpd.proxy_type) if not httpd.session: print('Newswire daemon has no session') time.sleep(60) diff --git a/outbox.py b/outbox.py index 3cb76fc83..ec2b36840 100644 --- a/outbox.py +++ b/outbox.py @@ -9,7 +9,7 @@ __module_group__ = "Timeline" import os from shutil import copyfile -from session import createSession +from session import create_session from auth import createPassword from posts import isImageMedia from posts import outboxMessageCreateWrap @@ -485,7 +485,7 @@ def postMessageToOutbox(session, translate: {}, 'for the post associated with the Announce activity') if not server.session: print('DEBUG: creating new session for c2s') - server.session = createSession(proxy_type) + server.session = create_session(proxy_type) if not server.session: print('ERROR: Failed to create session for postMessageToOutbox') return False diff --git a/person.py b/person.py index 34e98460d..1de71970d 100644 --- a/person.py +++ b/person.py @@ -60,7 +60,7 @@ from utils import get_user_paths from utils import get_group_paths from utils import local_actor_url from utils import dangerous_svg -from session import createSession +from session import create_session from session import getJson from webfinger import webfingerHandle from pprint import pprint @@ -1518,7 +1518,7 @@ def getActorJson(hostDomain: str, handle: str, http: bool, gnunet: bool, if existingSession: session = existingSession else: - session = createSession(proxy_type) + session = create_session(proxy_type) if nickname == 'inbox': nickname = domain diff --git a/posts.py b/posts.py index a462c515b..8060365ae 100644 --- a/posts.py +++ b/posts.py @@ -23,7 +23,7 @@ from cache import storePersonInCache from cache import getPersonFromCache from cache import expirePersonCache from pprint import pprint -from session import createSession +from session import create_session from session import getJson from session import postJson from session import postJsonString @@ -4077,7 +4077,7 @@ def getPublicPostsOfPerson(base_dir: str, nickname: str, domain: str, print('Signing key missing') print('Starting new session for getting public posts') - session = createSession(proxy_type) + session = create_session(proxy_type) if not session: if debug: print('Session was not created') @@ -4140,7 +4140,7 @@ def getPublicPostDomains(session, base_dir: str, nickname: str, domain: str, """ Returns a list of domains referenced within public posts """ if not session: - session = createSession(proxy_type) + session = create_session(proxy_type) if not session: return domainList person_cache = {} @@ -4236,7 +4236,7 @@ def getPublicPostInfo(session, base_dir: str, nickname: str, domain: str, """ Returns a dict of domains referenced within public posts """ if not session: - session = createSession(proxy_type) + session = create_session(proxy_type) if not session: return {} person_cache = {} diff --git a/session.py b/session.py index eb47964e7..c40cc03ac 100644 --- a/session.py +++ b/session.py @@ -20,21 +20,22 @@ from http.client import HTTPConnection base_directory = None -def createSession(proxy_type: str): +def create_session(proxy_type: str): session = None try: session = requests.session() except requests.exceptions.RequestException as ex: - print('WARN: requests error during createSession ' + str(ex)) + print('WARN: requests error during create_session ' + str(ex)) return None except SocketError as ex: if ex.errno == errno.ECONNRESET: - print('WARN: connection was reset during createSession ' + str(ex)) + print('WARN: connection was reset during create_session ' + + str(ex)) else: - print('WARN: socket error during createSession ' + str(ex)) + print('WARN: socket error during create_session ' + str(ex)) return None except ValueError as ex: - print('WARN: error during createSession ' + str(ex)) + print('WARN: error during create_session ' + str(ex)) return None if not session: return None diff --git a/shares.py b/shares.py index 7da718e97..3d45c4d3e 100644 --- a/shares.py +++ b/shares.py @@ -21,7 +21,7 @@ from auth import constantTimeStringCheck from posts import getPersonBox from session import postJson from session import postImage -from session import createSession +from session import create_session from utils import has_object_stringType from utils import date_string_to_seconds from utils import date_seconds_to_string @@ -1741,7 +1741,7 @@ def runFederatedSharesDaemon(base_dir: str, httpd, http_prefix: str, time.sleep(fileCheckIntervalSec) continue - session = createSession(proxy_type) + session = create_session(proxy_type) for sharesFileType in get_shares_files_list(): _updateFederatedSharesCache(session, shared_items_federated_domains, diff --git a/socnet.py b/socnet.py index 515385c55..4c8555aa6 100644 --- a/socnet.py +++ b/socnet.py @@ -7,7 +7,7 @@ __email__ = "bob@libreserver.org" __status__ = "Production" __module_group__ = "Moderation" -from session import createSession +from session import create_session from webfinger import webfingerHandle from posts import getPersonBox from posts import getPostDomains @@ -27,7 +27,7 @@ def instancesGraph(base_dir: str, handles: str, dotGraphStr = 'digraph instances {\n' if ',' not in handles: return dotGraphStr + '}\n' - session = createSession(proxy_type) + session = create_session(proxy_type) if not session: return dotGraphStr + '}\n' diff --git a/tests.py b/tests.py index 73b621377..b3a0664c4 100644 --- a/tests.py +++ b/tests.py @@ -34,7 +34,7 @@ from cache import storePersonInCache from cache import getPersonFromCache from threads import threadWithTrace from daemon import runDaemon -from session import createSession +from session import create_session from session import getJson from posts import getActorFromInReplyTo from posts import regenerateIndexForBox @@ -1179,7 +1179,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None: print('\n\n*******************************************************') print('Alice sends to Bob') os.chdir(aliceDir) - sessionAlice = createSession(proxy_type) + sessionAlice = create_session(proxy_type) inReplyTo = None inReplyToAtomUri = None subject = None @@ -1313,7 +1313,7 @@ def testPostMessageBetweenServers(base_dir: str) -> None: follow_person(aliceDir, 'alice', aliceDomain, 'bob', bobDomainStr, federation_list, False, False) - sessionBob = createSession(proxy_type) + sessionBob = create_session(proxy_type) bobPostLog = [] bobPersonCache = {} bobCachedWebfingers = {} @@ -1511,7 +1511,7 @@ def testFollowBetweenServers(base_dir: str) -> None: print('*********************************************************') print('Alice sends a follow request to Bob') os.chdir(aliceDir) - sessionAlice = createSession(proxy_type) + sessionAlice = create_session(proxy_type) inReplyTo = None inReplyToAtomUri = None subject = None @@ -1699,7 +1699,7 @@ def testSharedItemsFederation(base_dir: str) -> None: time.sleep(1) signing_priv_key_pem = None - sessionClient = createSession(proxy_type) + sessionClient = create_session(proxy_type) # Get Bob's instance actor print('\n\n*********************************************************') @@ -1729,7 +1729,7 @@ def testSharedItemsFederation(base_dir: str) -> None: print('*********************************************************') print('Alice sends a follow request to Bob') os.chdir(aliceDir) - sessionAlice = createSession(proxy_type) + sessionAlice = create_session(proxy_type) inReplyTo = None inReplyToAtomUri = None subject = None @@ -1809,7 +1809,7 @@ def testSharedItemsFederation(base_dir: str) -> None: sharedItemPrice = "1.30" sharedItemCurrency = "EUR" signing_priv_key_pem = None - sessionBob = createSession(proxy_type) + sessionBob = create_session(proxy_type) shareJson = \ sendShareViaServer(bobDir, sessionBob, 'bob', bobPassword, @@ -2130,7 +2130,7 @@ def testGroupFollow(base_dir: str) -> None: print('*********************************************************') print('Alice has some outbox posts') aliceOutbox = 'http://' + aliceAddress + '/users/alice/outbox' - session = createSession(None) + session = create_session(None) profileStr = 'https://www.w3.org/ns/activitystreams' asHeader = { 'Accept': 'application/ld+json; profile="' + profileStr + '"' @@ -2165,7 +2165,7 @@ def testGroupFollow(base_dir: str) -> None: print('*********************************************************') print('Alice sends a follow request to the test group') os.chdir(aliceDir) - sessionAlice = createSession(proxy_type) + sessionAlice = create_session(proxy_type) inReplyTo = None inReplyToAtomUri = None subject = None @@ -2242,7 +2242,7 @@ def testGroupFollow(base_dir: str) -> None: print('*********************************************************') print('Bob sends a follow request to the test group') os.chdir(bobDir) - sessionBob = createSession(proxy_type) + sessionBob = create_session(proxy_type) inReplyTo = None inReplyToAtomUri = None subject = None @@ -2856,7 +2856,7 @@ def testClientToServer(base_dir: str): print('\n\n*******************************************************') print('EVENT: Alice sends to Bob via c2s') - sessionAlice = createSession(proxy_type) + sessionAlice = create_session(proxy_type) followersOnly = False attachedImageFilename = base_dir + '/img/logo.png' mediaType = getAttachmentMediaType(attachedImageFilename) @@ -3036,7 +3036,7 @@ def testClientToServer(base_dir: str): assert 'alice@' + aliceDomain + ':' + str(alicePort) in \ open(bobDir + '/accounts/bob@' + bobDomain + '/following.txt').read() - sessionBob = createSession(proxy_type) + sessionBob = create_session(proxy_type) password = 'bobpass' outboxPath = bobDir + '/accounts/bob@' + bobDomain + '/outbox' inboxPath = aliceDir + '/accounts/alice@' + aliceDomain + '/inbox' @@ -5112,7 +5112,7 @@ def testUpdateActor(base_dir: str): print('\n\n*******************************************************') print('Alice updates her PGP key') - sessionAlice = createSession(proxy_type) + sessionAlice = create_session(proxy_type) cached_webfingers = {} person_cache = {} password = 'alicepass' diff --git a/webapp_moderation.py b/webapp_moderation.py index 855260181..4d9731c76 100644 --- a/webapp_moderation.py +++ b/webapp_moderation.py @@ -27,7 +27,7 @@ from webapp_utils import htmlHeaderWithExternalStyle from webapp_utils import htmlFooter from blocking import isBlockedDomain from blocking import isBlocked -from session import createSession +from session import create_session def htmlModeration(css_cache: {}, defaultTimeline: str, @@ -122,7 +122,7 @@ def htmlAccountInfo(css_cache: {}, translate: {}, if domain.endswith('.i2p'): proxy_type = None - session = createSession(proxy_type) + session = create_session(proxy_type) wordFrequency = {} originDomain = None