2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Python】Requestsモジュールのプロキシ,リダイレクト,SSL認証の設定方法

Last updated at Posted at 2020-12-23

やりたいこと

  • Proxyの設定
  • オートリダイレクトOFF
  • SSL認証OFF
  • SSL認証OFF時でリクエストする際に表示されるWarningの非表示
import requests
import ssl
import sys

#Warningの非表示
if not sys.warnoptions:
    import warnings
    warnings.simplefilter("ignore")

#プロキシ設定
proxies = {
  "http(またはhttps)": "<プロキシサーバ>:<ポート番号>",
}

url = "<URL>"
#引数にプロキシ設定,オートリダイレクトOFF,SSL認証OFFを指定してリクエスト
r = requests.get(url,proxies=proxies,verify=False,allow_redirects = False)
print (r)
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?