mewhrzad / marzpy

A Python library that helps you easily use Marzban's API panel
MIT License
98 stars 27 forks source link

Update subscription.py #14

Closed urbnywrt closed 6 months ago

urbnywrt commented 6 months ago

Fixed subsend_request()

Without this fix get_subscription_info and get_subscription are broken

erfjab commented 6 months ago

سلام، ممنون از شما. چرا بررسی response رو کامنت کردید؟

urbnywrt commented 6 months ago

سلام، ممنون از شما. چرا بررسی response رو کامنت کردید؟

image It causes error, but code seems okay without it

erfjab commented 6 months ago

Okay, it'll be merging after the last check. Thank you.

dry-stan commented 6 months ago

@urbnywrt
Thank you for the PR and for bringing up the error. After reviewing the code and the error message, here are my observations:

Explanation of the Error

The error occurs because response is None when await response.raise_for_status() is called. This might happen if the session.get call does not return a valid response object.

  1. The line result = await response.content is incorrect and unnecessary. This line is causing confusion and potential errors.
  2. The function should correctly handle the response and its content, either as JSON or text, based on the endpoint parameter.

    Summary

    • Removing the incorrect line that assigns result from await response.content resolves the NoneType error.

Please let me know if you need any further clarification or if there are additional changes you'd like to discuss. Your PR will be merged soon...