ossapi 3.1.4__tar.gz → 3.1.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ossapi
3
- Version: 3.1.4
3
+ Version: 3.1.6
4
4
  Summary: Complete python wrapper for osu! api v2 and v1.
5
5
  Author-email: Liam DeVoe <orionldevoe@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/circleguard/ossapi
@@ -108,14 +108,9 @@ class Oauth2SessionAsync(OAuth2Session):
108
108
  else:
109
109
  raise
110
110
 
111
- # No, we should not be using a session for every request. Yes, we are
112
- # not achieving 100% performance by doing this. The benefit is that we
113
- # don't require `async with OssapiAsync(...) as api:` syntax in order to
114
- # use ossapi.
115
- async with aiohttp.ClientSession() as session:
116
- return await session.request(
117
- method, url, headers=headers, data=data, **kwargs
118
- )
111
+ return await session.request(
112
+ method, url, headers=headers, data=data, **kwargs
113
+ )
119
114
 
120
115
  # our `request` function below relies on the ordering of these types. The
121
116
  # base type must come first, with any auxiliary types that the base type accepts
@@ -606,15 +601,22 @@ class OssapiAsync:
606
601
  f"{self.BASE_URL}{url}", session=aiohttp_session,
607
602
  params=params, data=data)
608
603
 
609
- self.log.info(f"made {method} request to {r.real_url}, data {data}")
604
+ # aiohttp annoyingly differentiates between url (no url fragments, for
605
+ # some reason) and real_url (actual url). They also use a URL object
606
+ # here instead of a string.
607
+ url = str(r.real_url)
608
+ self.log.info(f"made {method} request to {url}, data {data}")
610
609
  json_ = await r.json()
611
- self.log.debug(f"received json: \n{json.dumps(json_, indent=4)}")
612
- self._check_response(json_, r.url)
613
-
614
610
  # aiohttp sessions have to live as long as any responses returned via
615
611
  # the session. Wait to close it until we're done with the response `r`.
612
+ # Make sure we close this before we call _check_response, or any errors
613
+ # there will result in the session not being closed. We should probably
614
+ # move this to a try/finally block at some point for safety.
616
615
  await aiohttp_session.close()
617
616
 
617
+ self.log.debug(f"received json: \n{json.dumps(json_, indent=4)}")
618
+ self._check_response(json_, url)
619
+
618
620
  return self._instantiate_type(type_, json_)
619
621
 
620
622
  def _check_response(self, json_, url):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ossapi
3
- Version: 3.1.4
3
+ Version: 3.1.6
4
4
  Summary: Complete python wrapper for osu! api v2 and v1.
5
5
  Author-email: Liam DeVoe <orionldevoe@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/circleguard/ossapi
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ossapi"
3
- version = "3.1.4"
3
+ version = "3.1.6"
4
4
  description = "Complete python wrapper for osu! api v2 and v1."
5
5
  readme = "README.md"
6
6
  keywords = ["osu!", "wrapper", "api", "python"]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes