Skip to content

Issue: #3

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

Closed
3 tasks done
jaidencreep opened this issue Apr 29, 2021 · 2 comments
Closed
3 tasks done

Issue: #3

jaidencreep opened this issue Apr 29, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@jaidencreep
Copy link

jaidencreep commented Apr 29, 2021

  • - I have updated to the latest version of mystbin.py.
  • - I have searched the issues for duplicates.
  • - I have provided the entire traceback, if applicable.

Describe the bug

Unable to post to the Mystbin API

To Reproduce

import mystbin
mystbin_client = mystbin.Client()
a_string = "Here is an example"
mystbin_url = await mystbin_client.post(a_string, syntax=text) # Errors here on 2.1.0, no errors on 2.0.2
print(mystbin_url)

Expected behavior

Should print the URL retrieved from mystbin to the console

Additional context

This only errors on 2.1.0, downgrading to 2.0.2 (which is what I've done) does not error.
Reading through the latest commit (fdef2fd), lines 70-94 were deleted and not replaced in client.py, this is what is causing this error
Relevant Traceback (v2.1.0):

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.9/site-packages/discord/client.py", line 348, in _run_event
    await self.on_error(event_name, *args, **kwargs)
  File "/home/pi/Desktop/CBDiscordBot/main.py", line 59, in on_error
    error_mb = await mystbin_client.post(tb, syntax="text")
  File "/home/pi/.local/lib/python3.9/site-packages/mystbin/client.py", line 107, in _perform_async_post
    self.session = await self._generate_async_session()
AttributeError: 'HTTPClient' object has no attribute '_generate_async_session'
@jaidencreep jaidencreep added the bug Something isn't working label Apr 29, 2021
@jaidencreep
Copy link
Author

Extension: the latest update (2.1.2) fixed the error when doing asynchronous functions with mystbin, but with a synchronous session, an error still occurs.

Python 3.9.4 (tags/v3.9.4:1f2e308, Apr  6 2021, 13:40:21) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import mystbin
>>> import requests
>>> mb_client = mystbin.Client(session=requests.Session())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\creep\AppData\Local\Programs\Python\Python39\lib\site-packages\mystbin\client.py", line 67, in __init__
    self._generate_sync_session(session) if not self._are_we_async else session
AttributeError: 'HTTPClient' object has no attribute '_generate_sync_session'
>>>

@AbstractUmbra
Copy link
Collaborator

Ah, I missed something. I'm not able to fix this currently. I will handle it in a few hours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants