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

Better messaging on incorrect username or password #104

Closed
Fuchida opened this issue Mar 2, 2017 · 5 comments
Closed

Better messaging on incorrect username or password #104

Fuchida opened this issue Mar 2, 2017 · 5 comments

Comments

@Fuchida
Copy link

Fuchida commented Mar 2, 2017

This is what you get if you supply incorrect username or password
when uploading to pypi.

requests.exceptions.HTTPError: 401 Client Error: 
You must be identified to edit package information for url: https://pypi.python.org/pypi

Is it possible to have flit state that the provided username and password is
incorrect ?

full trace

Uploading dist/purrency-0.1-py2.py3-none-any.whl...                                                                              I-flit.upload
Traceback (most recent call last):
  File "/Users/asalim/playground/purrency/bin/flit", line 11, in <module>
    sys.exit(main())
  File "/Users/asalim/playground/purrency/lib/python3.5/site-packages/flit/__init__.py", line 88, in main
    repo=args.repository)
  File "/Users/asalim/playground/purrency/lib/python3.5/site-packages/flit/wheel.py", line 210, in wheel_main
    do_upload(wheel_path, wb.metadata, repo)
  File "/Users/asalim/playground/purrency/lib/python3.5/site-packages/flit/upload.py", line 164, in do_upload
    upload_wheel(file, metadata, repo)
  File "/Users/asalim/playground/purrency/lib/python3.5/site-packages/flit/upload.py", line 133, in upload_wheel
    resp.raise_for_status()
  File "/Users/asalim/playground/purrency/lib/python3.5/site-packages/requests/models.py", line 909, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: You must be identified to edit package information for url: https://pypi.python.org/pypi

In any case thank you for making Flit, it's been the best experience in uploading to Pypi
and sharing my code with others 👍

@takluyver
Copy link
Member

It's definitely possible to catch that exception and give a different message. I don't know if code 401 comes up in any other situations, though. Can you try uploading to a package that you don't have access to, and check what error number it uses? And also try with the new upload URL (https://upload.pypi.org/legacy/) to check that it behaves the same?

In any case thank you for making Flit, it's been the best experience in uploading to Pypi
and sharing my code with others 👍

:-) Thanks, I'm glad it's useful!

@Fuchida
Copy link
Author

Fuchida commented Mar 2, 2017

How do you upload to the new upload URL (https://upload.pypi.org/legacy/) 😕
Did a quick look at the docs but no luck

@Carreau
Copy link
Contributor

Carreau commented Mar 2, 2017

You can change your .pypirc like so:

$ cat ~/.pypirc | grep -v pass
[distutils]
index-servers =
    pypi
    testpypi
    localpypi

[pypi]
repository:https://upload.pypi.io/legacy/
username: xxx
password: yyy

[testpypi]
repository = https://testpypi.python.org/pypi
username: xxx
password: yyy

[localpypi]
repository:http://localhost:8000/pypi
username: xxx

Here i'm also setting multiple remotes.

@Fuchida
Copy link
Author

Fuchida commented Mar 2, 2017

  • uploading to a package that you don't have access
(pythoscope) ➜  pythoscope flit wheel --upload
'hello'
Copying package file(s) from pythoscope.py                                                                                        I-flit.wheel
Writing metadata files                                                                                                            I-flit.wheel
Writing the record of files                                                                                                       I-flit.wheel
Wheel built: dist/pythoscope-0.1-py2.py3-none-any.whl                                                                             I-flit.wheel
Using repository at https://pypi.python.org/pypi                                                                                 I-flit.upload
Username: asalim
Password:
Uploading dist/pythoscope-0.1-py2.py3-none-any.whl...                                                                            I-flit.upload
Uploading forbidden; trying to register and upload again                                                                         W-flit.upload
Traceback (most recent call last):
  File "/Users/asalim/playground/sandbox/pythoscope/lib/python3.5/site-packages/flit/upload.py", line 164, in do_upload
    upload_wheel(file, metadata, repo)
  File "/Users/asalim/playground/sandbox/pythoscope/lib/python3.5/site-packages/flit/upload.py", line 133, in upload_wheel
    resp.raise_for_status()
  File "/Users/asalim/playground/sandbox/pythoscope/lib/python3.5/site-packages/requests/models.py", line 909, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: You are not allowed to edit 'pythoscope' package information for url: https://pypi.python.org/pypi

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/asalim/playground/sandbox/pythoscope/bin/flit", line 11, in <module>
    sys.exit(main())
  File "/Users/asalim/playground/sandbox/pythoscope/lib/python3.5/site-packages/flit/__init__.py", line 88, in main
    repo=args.repository)
  File "/Users/asalim/playground/sandbox/pythoscope/lib/python3.5/site-packages/flit/wheel.py", line 210, in wheel_main
    do_upload(wheel_path, wb.metadata, repo)
  File "/Users/asalim/playground/sandbox/pythoscope/lib/python3.5/site-packages/flit/upload.py", line 170, in do_upload
    register(metadata, repo)
  File "/Users/asalim/playground/sandbox/pythoscope/lib/python3.5/site-packages/flit/upload.py", line 145, in register
    resp.raise_for_status()
  File "/Users/asalim/playground/sandbox/pythoscope/lib/python3.5/site-packages/requests/models.py", line 909, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: You are not allowed to store 'pythoscope' package information for url: https://pypi.python.org/pypi
pythoscope) ➜  pythoscope flit wheel --upload
'hello'
Copying package file(s) from pythoscope.py                                                                                        I-flit.wheel
Writing metadata files                                                                                                            I-flit.wheel
Writing the record of files                                                                                                       I-flit.wheel
Wheel built: dist/pythoscope-0.1-py2.py3-none-any.whl                                                                             I-flit.wheel
Using repository at https://upload.pypi.io/legacy/                                                                               I-flit.upload
Uploading dist/pythoscope-0.1-py2.py3-none-any.whl...                                                                            I-flit.upload
Uploading forbidden; trying to register and upload again                                                                         W-flit.upload
Traceback (most recent call last):
  File "/Users/asalim/playground/sandbox/pythoscope/lib/python3.5/site-packages/flit/upload.py", line 164, in do_upload
    upload_wheel(file, metadata, repo)
  File "/Users/asalim/playground/sandbox/pythoscope/lib/python3.5/site-packages/flit/upload.py", line 133, in upload_wheel
    resp.raise_for_status()
  File "/Users/asalim/playground/sandbox/pythoscope/lib/python3.5/site-packages/requests/models.py", line 909, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: You are not allowed to upload to 'pythoscope'. for url: https://upload.pypi.io/legacy/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/asalim/playground/sandbox/pythoscope/bin/flit", line 11, in <module>
    sys.exit(main())
  File "/Users/asalim/playground/sandbox/pythoscope/lib/python3.5/site-packages/flit/__init__.py", line 88, in main
    repo=args.repository)
  File "/Users/asalim/playground/sandbox/pythoscope/lib/python3.5/site-packages/flit/wheel.py", line 210, in wheel_main
    do_upload(wheel_path, wb.metadata, repo)
  File "/Users/asalim/playground/sandbox/pythoscope/lib/python3.5/site-packages/flit/upload.py", line 170, in do_upload
    register(metadata, repo)
  File "/Users/asalim/playground/sandbox/pythoscope/lib/python3.5/site-packages/flit/upload.py", line 145, in register
    resp.raise_for_status()
  File "/Users/asalim/playground/sandbox/pythoscope/lib/python3.5/site-packages/requests/models.py", line 909, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 410 Client Error: This API is no longer supported, instead simply upload the file. for url: https://upload.pypi.io/legacy/

@takluyver
Copy link
Member

OK, it looks like we can assume that 401 means you got your username/password wrong.

@Fuchida Fuchida closed this as completed Oct 10, 2023
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

No branches or pull requests

3 participants