Skip to content
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

Updated get_connection deprecated method to avoid warning #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Echizenk
Copy link

Updated get_connection deprecated method to avoid warning and refactored some code.

@ritajie
Copy link
Owner

ritajie commented Aug 19, 2024

@Echizenk Thank you very much for your contribution. This PR is very meaningful! 👍

Can you go a step further and make your new code support Python2 ? I believe this will be useful for old users.

In order to facilitate the testing, I just updated the master branch. Now it has a Github Action to perform the test. You can execute git rebase master locally.

image


def _build_url(connection_pool, request):
scheme = connection_pool.scheme if connection_pool.scheme in ("http", "https") else "http"
host = f"[{connection_pool.host}]" if ":" in connection_pool.host else connection_pool.host
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The f-strings is not supported for Python 2. 🥲

@Echizenk
Copy link
Author

Echizenk commented Aug 19, 2024

I am sorry but not sure how to use those tests or be sure that the code is compatible with Python 2, we just updated your code to work fine with our project and without warnings while using a recent version of Python 3. Feel free to update or make any changes needed if you consider it :)

I was really helpful for what we needed!

@ritajie
Copy link
Owner

ritajie commented Aug 20, 2024

@Echizenk

How to execute tests manually

cd requests_to_curl
python test.py

The test case did find some unexpected behavior: https://github.com/ritajie/requests_to_curl/actions/runs/10457080817/job/28976393611?pr=5

How to execute Github Action

The test file will be automatically execute on Github Action.

I just noticed that "The first-time contributors will require approval to run workflows". I have changed this configuration, and now you may trigger Github Action by submitting new code.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants