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

gh-51: Fix module installation error with requests #52

Closed
wants to merge 1 commit into from

Conversation

Alexandr153
Copy link

@Alexandr153 Alexandr153 commented Aug 31, 2024

I think you are working with an old version of the requests module, because the latest version specifies at the very beginning how the get() object should be used:
Снимок экрана 2024-08-31 в 17 42 06

Proposal:

import requests

requests.get()

Summary by Sourcery

Fix the module installation error by updating the code to use 'requests.get()' explicitly, ensuring compatibility with the latest version of the 'requests' library.

Bug Fixes:

  • Fix module installation error by explicitly using 'requests.get()' instead of 'get()' to ensure compatibility with the latest version of the 'requests' module.

Copy link
Contributor

sourcery-ai bot commented Aug 31, 2024

Reviewer's Guide by Sourcery

This pull request addresses an issue with the module installation error related to the 'requests' library. The main change involves updating the way the 'get()' function is called, ensuring compatibility with the latest version of the 'requests' module.

File-Level Changes

Change Details Files
Update 'get()' function calls to use 'requests.get()'
  • Replace 'r = get(url, timeout=10)' with 'r = requests.get(url, timeout=10)'
  • Replace 'r = get(url)' with 'r = requests.get(url)'
ufpy/github/download.py

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Alexandr153 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@@ -62,7 +62,7 @@ def __init__(self, repo: str, base_download_path: str = CWD, branch_name: str =

def __enter__(self):
url = f'https://github.com/{self.__repo}/archive/{self.__branch}.zip'
r = get(url, timeout=10)
r = requests.get(url, timeout=10)
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (performance): Consider adding a timeout to the requests.get call in the download_file method

For consistency with the enter method and to prevent hanging on slow connections, it might be beneficial to add a timeout parameter to this request as well.

Suggested change
r = requests.get(url, timeout=10)
r = requests.get(url, timeout=(5, 30))

@n0n1m
Copy link
Member

n0n1m commented Aug 31, 2024

That's totally not the issue.

@n0n1m
Copy link
Member

n0n1m commented Aug 31, 2024

The issue is the library code running without requests installed

@n0n1m
Copy link
Member

n0n1m commented Aug 31, 2024

That's how discord.py addresses this issue: https://github.com/Rapptz/discord.py/blob/master/setup.py

@n0n1m
Copy link
Member

n0n1m commented Aug 31, 2024

I'll make pull request with my fix in a sec

Copy link
Member

@n0n1m n0n1m left a comment

Choose a reason for hiding this comment

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

It is literally the same thing

@n0n1m
Copy link
Member

n0n1m commented Aug 31, 2024

@bleudev I recomend closing this request

@bleudev
Copy link
Member

bleudev commented Aug 31, 2024

@Alexandr153 It's really fixes an issue? I used this import because of i don't need to use all methods from requests. Only get(). Can you explain me this method of solving this problem?

@bleudev
Copy link
Member

bleudev commented Aug 31, 2024

I merged #53. Can this solve this problem?

@bleudev
Copy link
Member

bleudev commented Aug 31, 2024

@bleudev I recomend closing this request

Too

@bleudev bleudev closed this Aug 31, 2024
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.

3 participants