-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use with in examples, remove close in json() #188
Conversation
bdf612d
to
d4d03eb
Compare
@@ -321,7 +321,7 @@ def json(self) -> Any: | |||
obj = json_module.load(self._raw) | |||
if not self._cached: | |||
self._cached = obj | |||
self.close() | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the .close()
here, as it's not standard in CPython
try: | ||
fitbit_json = fitbit_get_response.json() | ||
with requests.get(url=FBIS, headers=FBH) as fitbit_get_response: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few of these, I moved the initial connection into the try/except block
github_response.close() | ||
print("✂️ Disconnected from Github API") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed these closes, and the disconnected message
Wow, thank you. Saved me from all these changes. 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks for working through all of those!
I tested a handful of them on a Feather S3 TFT and the ESP32SPI ones on a PyPortal Titano
Updating https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k to 6.0.0 from 5.2.1: > Merge pull request adafruit/Adafruit_CircuitPython_Wiznet5k#150 from pinkavaj/pi-fix-sock-exit > Merge pull request adafruit/Adafruit_CircuitPython_Wiznet5k#160 from justmobilize/remove-wsgiserver Updating https://github.com/adafruit/Adafruit_CircuitPython_ConnectionManager to 1.2.0 from 1.1.0: > Merge pull request adafruit/Adafruit_CircuitPython_ConnectionManager#13 from justmobilize/close-all-and-counts Updating https://github.com/adafruit/Adafruit_CircuitPython_Requests to 3.2.6 from 3.2.5: > Merge pull request adafruit/Adafruit_CircuitPython_Requests#188 from justmobilize/with-updates Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Updated download stats for the libraries
Update the examples to use
with request.method as response:
and removed the close in theResponse.json()
as it doesn't match CPythonTested the wifi standard and advanced and the rocketlive in advanced
fixes #186