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

SyntaxError: f-string: unmatched '[' #28

Closed
emmamarkle opened this issue Jul 8, 2024 · 4 comments · Fixed by #30
Closed

SyntaxError: f-string: unmatched '[' #28

emmamarkle opened this issue Jul 8, 2024 · 4 comments · Fixed by #30

Comments

@emmamarkle
Copy link

I copied this code from the Shiftshadow website and keep getting this error...

Code copied from website:

from swiftshadow import QuickProxy
from requests import get

proxy = QuickProxy()
resp = get('https://checkip.amazonaws.com', proxies={proxy[1]: proxy[0]})
print(resp.text)

Error message

Traceback (most recent call last):
  File "filename", line 1, in <module>
    from swiftshadow import QuickProxy
  File " filename", line 1, in <module>
    from swiftshadow.providers import Providers
  File " filename", line 14
    proxy = [f'{proxy['host']}:{proxy['port']}',proxy['protocol']]
                       ^
SyntaxError: f-string: unmatched '['
@sachin-sankar
Copy link
Owner

Have started to look into the issue.

@shayoyem
Copy link

shayoyem commented Jul 10, 2024

Fixed this issue by updating my python to 3.12.x

@whitks
Copy link

whitks commented Jul 16, 2024

fixed this issue by replacing ' ' with "" in host and port :
proxy = [f'{proxy["host"]}:{proxy["port"]}',proxy['protocol']]

@cyborgdennett
Copy link

if you want to use in colab do this:

!pip install swiftshadow
!sed -i "s/proxy = \[f'{proxy\['host']}:{proxy\['port']}',proxy\['protocol']]/proxy = \[f'{proxy\[\"host\"]}:{proxy\[\"port\"]}\',proxy\[\'protocol\']]/g" /usr/local/lib/python3.10/dist-packages/swiftshadow/providers.py

@sachin-sankar sachin-sankar linked a pull request Jul 21, 2024 that will close this issue
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 a pull request may close this issue.

5 participants