1. Web Scraping爬虫 for Mac urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>

Solution:  if 1) does not work, then try to use 2).  Reference is here.

        1)

  1.   pip install --upgrade certifi

        2)

  1. open /Applications/Python\ 3.6/Install\ Certificates.command
  • if running a python file to use https call, have error like
    "SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661"

    Solution:

      then solve it by adding

  1. configuration.verify_ssl = False

in the test file.
Then it will skip verifying SSL certificate when calling API from https server.

  • if running a python file to use https call, have the warning of InsecureRequestWarning

    Solution:

      then solve it by adding

import urllib3
urllib3.disable_warnings()

in the test file. 
Then it will skip warning.

  • Remove leading whitespace 去除string前面的空格

    Solution:

  1. >>> ' hello world!'.lstrip()
  2. 'hello world!'
    1. Web Scraping爬虫

    看网页编码方式( 一般为“utf-8”)

    Solution: F12功能键,即可使用开发者工具,在窗口console标签下,键入 "document.charset" 即可查看网页的编码方式

[Python] Frequently used method or solutions for issues的更多相关文章

  1. [JavaScript] Frequently used method or solutions for issues

    Get the file name from the file path Solution: var fileName = fullPath.replace(/^.*[\\\/]/, ''); // ...

  2. [CSS] Frequently used method or solutions for issues

    Stick button in right side in html Solution: //In the html <div class="float__button" & ...

  3. [Java] Frequently used method or solutions for issues

    模板: Split string into parts based on new line in java Solution:   Reference is here. 1) get out of t ...

  4. 关于Python的函数(Method)与方法(Function)

    先上结论: 函数(function)是Python中一个可调用对象(callable), 方法(method)是一种特殊的函数. 一个可调用对象是方法和函数,和这个对象无关,仅和这个对象是否与类或实例 ...

  5. Python tricks(2) -- method默认参数和闭包closure

    Python的method可以设置默认参数, 默认参数如果是可变的类型, 比如list, map等, 将会影响所有的该方法调用. 下面是一个简单的例子 def f(a=None, l=[]): if ...

  6. 2.Python函数/方法(method/function)详解

    1.什么是函数 它是一段功能代码,理解为一种功能行为,在内存中有空间区域,函数需要被调用才能执行(通过函数名来调用): 好处: 1).提高代码的复用性 2).提升代码的阅读性 3).增加代码的扩展性 ...

  7. [Python] String strip() Method

    Description The method strip() returns a copy of the string in which all chars have been stripped fr ...

  8. [Python] The get() method on Python dicts and its "default" arg

    # The get() method on dicts # and its "default" argument name_for_userid = { 382: "Al ...

  9. Python String startswith() Method

    一,摘自官方API  https://docs.python.org/3/library/stdtypes.html#methods str.startswith(prefix[, start[, e ...

随机推荐

  1. ASP.NET Core 实现用户登录验证的最低配置

    背景是在一个项目中增加临时登录功能,只需验证用户是否登录即可,所需的最低配置与实现代码如下. 在 Startup 的 ConfigureServices() 方法中添加 Authentication ...

  2. {前端CSS} 语法 Css的几种引入方式 css选择器 选择器的优先级 CSS属性相关 背景属性 边框 CSS盒子模型 清除浮动 overflow溢出属性  定位(position)z-index

    前端CSS CSS介绍 CSS(Cascading Style Sheet,层叠样式表)定义如何显示HTML元素,给HTML设置样式,让它更加美观. 当浏览器读到一个样式表,它就会按照这个样式表来对文 ...

  3. JS弹出对话框的三种方式

    JS弹出对话框的三种方式 我们用到了alert()方法.prompt()方法.prompt()方法,都是在网页有一个弹出框,那么就让我们探究一下他们之间的区别: 一.第一种:alert()方法 < ...

  4. CM5.x配置spark错误解决

    通过cloudera manager 5.x添加spark服务,在创建服务过程中,发现spark服务创建失败,可以通过控制台错误输出看到如下日志信息: + perl -pi -e 's#{{CMF_C ...

  5. HDMI 接口及CEC信号

    HDMI 接口及CEC信号 2016年12月02日 14:16:38 King-Five 阅读数:16389 HDMI接口 HDMI(High Definition Multimedia Interf ...

  6. SHOW PROCESSLIST shows which threads are running 查看线程 解决瓶颈

    小结: 1.查看全部线程: https://dev.mysql.com/doc/refman/8.0/en/show-processlist.html MySQL 8.0 Reference Manu ...

  7. 读书笔记iOS-Core-Animation-Advanced-Techniques,iOS性能调试工具

    调试卡顿,除了使用timer profile,还可以使用 OpenGL ES驱动工具 OpenGL ES Driver工具显示的GPU利用率,打开Color Blended Layers 我们给图片和 ...

  8. delphi string.split 按照任意字符串分割语句

    delphi string.split 按照任意字符串分割语句 1.就是把一个指定的字符串用指定的分割符号分割成多个子串,放入一个 TStringList 中 function ExtractStri ...

  9. 查找->静态查找表->顺序查找(顺序表)

    文字描述 顺序查找的查找过程为:从表中最后一个记录开始,逐个进行记录的关键字和给定值的比较,若某个记录的关键字和给定值比较相等,则查找成功,找到所查记录:反之,若直至第一个记录,其关键字和给定值比较都 ...

  10. 用promise和async/await分别实现红绿灯

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...