小编Hae*_*aem的帖子

带有代理的 Python 请求导致 SSLError WRONG_VERSION_NUMBER

我不能在 Python 中使用不同的代理。

我的代码:

import requests

proxies = {
    "https":'https://154.16.202.22:3128',
    "http":'http://154.16.202.22:3128'
    }

r=requests.get('https://httpbin.org/ip', proxies=proxies)
print(r.json()) 
Run Code Online (Sandbox Code Playgroud)

我得到的错误是:

.
.
.
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='httpbin.org', port=443): Max retries exceeded with url: /ip (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1122)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 
  .
  .
  .
requests.exceptions.SSLError: HTTPSConnectionPool(host='httpbin.org', port=443): Max retries exceeded with url: /ip (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1122)')))
Run Code Online (Sandbox Code Playgroud)

我执行了pip …

python ssl proxy python-requests

7
推荐指数
2
解决办法
7540
查看次数

尝试使用append方法在同一行中打印多个文本,但输出不同

尝试在单行中将可能的数字组合打印为列表,但是列表输出错误。我的输出是这样的:

[[1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1]]
Run Code Online (Sandbox Code Playgroud)

什么时候应该是这样的:

[0, 0, 0]
[0, 0, 1]
[0, 1, 0]
[0, 1, 1]
[1, 0, 0]
[1, 0, 1]
[1, 1, 0]
[1, 1, 1]
Run Code Online (Sandbox Code Playgroud)

我的代码是

if __name__ == '__main__':
    x = 1
    y = 1
    z = 1 
kordinat = ["x","y","z"]
result = []
for xx in range(x+1):
    kordinat[0] = xx
    for yy in …
Run Code Online (Sandbox Code Playgroud)

python python-3.x

3
推荐指数
1
解决办法
97
查看次数

不幸的是,相机已停止在Kitkat工作

我正在尝试整合在Android中拍照.在运行我正在运行的应用程序并且错误" 不幸的是,相机已停止 ",但我的应用程序没有崩溃.我在Android"KITKAT"中发现了这个问题.这是我用来拍照的示例代码,

使用这个功能我正在拍照,

private void take_picture_intent() {
        Intent takePictureIntent = (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT)
                ? new Intent(MediaStore.ACTION_IMAGE_CAPTURE_SECURE)
                : new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        if (takePictureIntent.resolveActivity(this.getActivity().getPackageManager()) != null) {
            File photoFile = null;
            try {
                photoFile = createImageFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (photoFile != null) {
                photoURI = FileProvider.getUriForFile(this.getActivity(), "com.android.myapplication.fileprovider", photoFile);
                Log.e(TAG, "photoFile: "+photoFile+" ,URI : "+photoURI.getPath());
                takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
                getActivity().startActivityForResult(takePictureIntent, SelectMedia.IMAGE_CAPTURE_AT_THE_DOOR);
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

此函数用于生成图像路径,

private File createImageFile() throws IOException {
        // Create an image file name
        String timeStamp = …
Run Code Online (Sandbox Code Playgroud)

android android-camera android-4.4-kitkat

0
推荐指数
1
解决办法
858
查看次数