python - 403 客户端错误 : Invalid or non-existent authentication information while uploading to Pypi with twine

标签 python upload http-status-code-403 pypi twine

403客户端错误:使用Twine上传新模块到pypi时出现无效或不存在的身份验证信息

Win10 Pro 1803 Biuld 17134.1069 64 位//Python 3.7.5 32 位//pip 19.3.1

我成功创建了 tar.gz 文件。和whl。在 dist 文件夹中,注册于 https://pypi.org/通过电子邮件确认并开始上传。

我使用命令行检查了这两个文件(“通过”)

并执行了以下操作:

Uploading distributions to https://upload.pypi.org/legacy/
Enter your username: gakonorde
Enter your password:
Uploading gersyll-Alpha.release-py3-none-any.whl
100%|█████████████████████████████████████████████████████████████████████████████| 6.43k/6.43k [00:01<00:00, 5.12kB/s]
NOTE: Try --verbose to see response content.
HTTPError: 403 Client Error: Invalid or non-existent authentication information. for url: https://upload.pypi.org/legacy/

命令行不允许我在用户名后输入密码。我只能按 ENTER 键。

我也尝试过

Password for 'your-username' in 'https://upload.pypi.org/legacy/':

...再说一遍,除了 ENTER 之外我什么都不能按。

然后我使用 https://pypi.org/ 的凭据创建了 .pypirc 文件及其测试版本并再次运行 python -m twine upload dist/*

系统没有要求我输入密码,但遇到了同样的错误:

Uploading distributions to https://upload.pypi.org/legacy/
Uploading gersyll-Alpha.release-py3-none-any.whl
100%|█████████████████████████████████████████████████████████████████████████████| 6.43k/6.43k [00:01<00:00, 5.46kB/s]
NOTE: Try --verbose to see response content.
HTTPError: 403 Client Error: Invalid or non-existent authentication information. for url: https://upload.pypi.org/legacy/

当我将 .pypirc 与 API token 结合使用时,问题仍然存在。

我可以在 https://pypi.org/ 输入我的帐户,所以它显然存在(并且电子邮件已验证)。

我还添加了第二封电子邮件,经过验证并将其设置为主要电子邮件(没有任何更改)。

这是我的 setup.py:

import setuptools

with open("README.md", "r") as fh:
    long_description = fh.read()

setuptools.setup(
    name="gersyll",
    version="Alpha release",
    author="gakonorde",
    author_email="gabrielko@yandex.ru",
    description="This module counts the number of words of different syllable length for all texts in a directory",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/gakonorde/gersyll",
    packages=setuptools.find_packages(),
    classifiers=[
        "Programming Language :: Python :: 3.7",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
    ],
    python_requires='>=3.7',
)

我做错了什么?

任何帮助将不胜感激。

编辑: .pypirc 文件与 .setup、README、License、dict/等位于同一文件夹中。

其内容如下:

[distutils]
index-servers =
  pypi
  pypitest

[pypitest]
repository: testpypi.python.org/pypi
username: gakonorde 
password: [my_password]

[pypi]
repository: upload.pypi.org/legacy
username: gakonorde
password: [my_password]

最佳答案

解决了

python -m twine upload -u USERNAME -p PASSWORD dist/*

关于python - 403 客户端错误 : Invalid or non-existent authentication information while uploading to Pypi with twine,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58971443/

相关文章:

python - Pandas 自动将我的字符串列转换为 float

python - 在列表的不同行上连续打印 5 个项目?

python - 带身份验证的网络 IPC(Python)

python - Requests.get 不使用 & 字符

python - AppEngine GeoPt 数据上传

java - 使用jsp将图像从html上传到mysql数据库

google-api - Google API 返回访问未配置

opencv - 如何在opencv-visualstudio2010 x64 win7中上传图片..

php - CodeIgniter 网站上的 Firefox 403 字体

docker - Gitlab - 获取作业时发生错误