Compare commits

...

3 Commits

Author SHA1 Message Date
Kay Faraday e747e3c120 update User-Agent 2022-01-08 04:28:04 +00:00
Kay Faraday 94a8b53f28 strip access tokens for ease of use 2022-01-08 04:27:09 +00:00
Kay Faraday f709bed0e9 update defaults 2022-01-08 04:26:02 +00:00
2 changed files with 7 additions and 7 deletions

View File

@ -1,7 +1,7 @@
{ {
"site": "https://botsin.space", "site": "https://freak.university",
"cw": null, "cw": null,
"learn_from_cw": false, "learn_from_cw": true,
"ignored_cws": [], "ignored_cws": [],
"mention_handling": 1, "mention_handling": 1,
"max_thread_length": 15, "max_thread_length": 15,
@ -9,9 +9,9 @@
"limit_length": false, "limit_length": false,
"length_lower_limit": 5, "length_lower_limit": 5,
"length_upper_limit": 50, "length_upper_limit": 50,
"overlap_ratio_enabled": false, "overlap_ratio_enabled": true,
"overlap_ratio": 0.7, "overlap_ratio": 0.7,
"generation_mode": "markov", "generation_mode": "markov",
"access_token": "", "access_token": "",
"db_path": "posts.db" "db_path": ""
} }

View File

@ -10,7 +10,7 @@ from http import HTTPStatus
def http_session_factory(headers={}): def http_session_factory(headers={}):
py_version = '.'.join(map(str, sys.version_info)) py_version = '.'.join(map(str, sys.version_info))
user_agent = ( user_agent = (
'pleroma-ebooks (https://github.com/ioistired/pleroma-ebooks); ' 'pleroma-ebooks (https://lab.freak.university/KayFaraday/pleroma-ebooks); '
'aiohttp/{aiohttp.__version__}; ' 'aiohttp/{aiohttp.__version__}; '
'python/{py_version}' 'python/{py_version}'
) )
@ -27,8 +27,8 @@ class LoginFailed(Exception):
class Pleroma: class Pleroma:
def __init__(self, *, api_base_url, access_token): def __init__(self, *, api_base_url, access_token):
self.api_base_url = api_base_url.rstrip('/') self.api_base_url = api_base_url.rstrip('/')
self.access_token = access_token self.access_token = access_token.strip()
self._session = http_session_factory({'Authorization': 'Bearer ' + access_token}) self._session = http_session_factory({'Authorization': 'Bearer ' + self.access_token})
self._logged_in_id = None self._logged_in_id = None
async def __aenter__(self): async def __aenter__(self):