Skip to content

Commit d26b381

Browse files
committed
added private generate async session as it was needlessly removed. Fixes #3
1 parent fdef2fd commit d26b381

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

mystbin/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@
2929

3030
__version__ = "1.0.1"
3131
VersionInfo = namedtuple("VersionInfo", "major minor micro releaselevel serial")
32-
version_info = VersionInfo(major=2, minor=1, micro=0, releaselevel="alpha", serial=0)
32+
version_info = VersionInfo(major=2, minor=1, micro=2, releaselevel="final", serial=0)

mystbin/client.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ def __init__(
6767
self._generate_sync_session(session) if not self._are_we_async else session
6868
)
6969

70+
async def _generate_async_session(self) -> aiohttp.ClientSession:
71+
"""
72+
This method will create a new and blank `aiohttp.ClientSession` instance for use.
73+
This method should not be called if a session is passed to the constructor.
74+
"""
75+
self.session = aiohttp.ClientSession()
76+
77+
return self.session
78+
7079
def post(self, content: str, syntax: str = None) -> Union[Paste, Awaitable]:
7180
"""
7281
This will post to the Mystb.in API and return the url.
@@ -93,7 +102,7 @@ def _perform_sync_post(self, content: str, syntax: str = None) -> Paste:
93102
"meta": (None, json.dumps(payload), "application/json"),
94103
},
95104
timeout=CLIENT_TIMEOUT,
96-
headers={"Authorization": self.api_key}
105+
headers={"Authorization": self.api_key},
97106
)
98107

99108
if response.status_code not in [200, 201]:

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "mystbin.py"
3-
version = "2.1.0"
3+
version = "2.1.2"
44
description = "A small simple wrapper around the mystb.in API."
55
authors = ["AbstractUmbra <[email protected]>"]
66
license = "MIT"

0 commit comments

Comments
 (0)