我试图在Python中制作一个简短的大规模下载程序脚本,以便在本地存储图像列表.
它对于http图像网址非常适用,但无法使用https网址下载任何图像.有问题的代码行是:
import urllib.request
urllib.request.urlretrieve(url, filename)
Run Code Online (Sandbox Code Playgroud)
例如,
https://cdn.discordapp.com/attachments/299398003486097412/303580387786096641/FB_IMG_1490534565948.jpg结果HTTP Error 403: Forbidden,以及任何其他https图像.
这让我有两个问题:
https基本上只是文件,为什么图像甚至都有网址?这是堆栈跟踪:
Traceback (most recent call last):
File "img_down.py", line 52, in <module>
main()
File "img_down.py", line 38, in main
save_img(d, l)
File "img_down.py", line 49, in save_img
stream = read_img(url)
File "img_down.py", line 42, in read_img
with urllib.request.urlopen(url) as response:
File "D:\Users\Jan\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "D:\Users\Jan\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 532, …Run Code Online (Sandbox Code Playgroud) 我正在heroku上部署一个Django应用程序并尝试强制https所有页面.我使用以下设置:
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
Run Code Online (Sandbox Code Playgroud)
现在,当我访问www.mysite.de时,实际上并没有将我重定向到https.我缺少什么想法?
我正在尝试使用REST API将一些数据发布到我的Firebase数据库.但是,我一直收到错误:response with status: 405. Method not allowed for URL: https://myurl.firebaseio.com/data
这是我使用POST请求的方式:
createNewRoute(route){
var url;
var data = {
RouteStartAddress: route.startAddress,
RouteEndAddress : route.endAddress,
RouteStartCord: route.startCord,
RouteEndCord: route.endCord,
DepatureDateTime: route.depatureDateTime,
Seats: route.seats,
Note: route.note,
IsActive: true,
DriverSId: route.userId,
TimeToDist: route.timeToDist,
MetersToDist: route.metersToDist
};
url = this.routeUrl;
var response = this.http.post(url, data).map(res => res.json());
return response;
}
Run Code Online (Sandbox Code Playgroud) 我需要所有http来重定向https:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^some-domain\.com$ [NC]
RewriteRule ^(.*)$ https://some-domain.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} /(\.+) [OR]
RewriteCond %{THE_REQUEST} /(\?+) [OR]
RewriteCond %{THE_REQUEST} /(/+)
RewriteRule ^(.*)$ 404.html [L]
RewriteRule ^core/(install|temp|smarty|modules|languages|includes|functions|fonts|files|config|classes|cache|backup|tpl)/(.*) - [F]
RewriteRule ^data/(.+)\.(tpl\.html|php|php3|php4|php5|phtml|pl|cgi) - [F]
RewriteRule ^install_check\.html$ install.php?check=yes [L]
RewriteRule ^index\.html$ index.php [L]
RewriteRule ^news\.html$ index.php?news=yes [L]
RewriteRule ^price\.html$ index.php?show_price=yes [L]
RewriteRule ^cart\.html$ index.php?shopping_cart=yes [L]
RewriteRule ^wide_search\.html$ index.php?search_with_change_category_ability=yes [L]
RewriteRule ^feedback\.html$ index.php?feedback=yes [L]
RewriteRule ^compare\.html$ index.php?comparison_products=yes [L]
RewriteRule ^page_([0-9]+)\.html$ index.php?show_aux_page=$1 [L]
RewriteRule ^product_([0-9]+)\.html$ index.php?productID=$1 [L]
RewriteRule ^category_([0-9]+)\.html$ index.php?categoryID=$1 [L] …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的网站上安装SSL 证书,为此我正在使用Godaddy ssl证书。我已经生成了csr,请求了证书并将证书也上传到了我的服务器上。
我正在使用KEYTOOL来使用所有这些
我从godaddy下载的.zip文件中有三个文件。在安装证书时。我必须使用三个命令将证书添加到密钥库中。它们的命令适用于根证书,中间证书和主要证书。
如何识别zip中的根,中级和主证书。
我有github pages网站,它向HTTP托管服务器发出请求,而我的浏览器阻止了它。
它是大学的作业,所以我真的不想为服务器上的HTTPS付费,并且不能将其他东西用于前端,因为我已将URL发送给教授,期望这是我的Web应用程序将在的位置托管。
有什么我可以做的,不需要花那么多钱吗?
我需要检查一些网站的更新,我的脚本适用于我尝试的所有网站,除了一个.
我很确定它与TLS/SSL有关,但我没有找到任何关于错误的有用信息.
这是脚本:
package main
import (
"net/http"
"fmt"
"os"
"crypto/tls"
)
func main(){
client := &http.Client{
Transport: &http.Transport{
DisableKeepAlives: false,
MaxIdleConnsPerHost: 10,
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
},
}
fmt.Println(client)
req, _ := http.NewRequest("GET", os.Args[1], nil)
_, err := client.Do(req)
if err != nil {
fmt.Println("Something bad happened: ", err)
}
}
Run Code Online (Sandbox Code Playgroud)
这是输出:
[root@74dfbb491710 wd]# go run ssl.go https://google.com
&{0xc4200ce000 <nil> <nil> 0s}
[root@74dfbb491710 wd]# go run ssl.go https://jobs-eu.hudson.com
&{0xc4200e4000 <nil> <nil> 0s}
Something bad happened: Get https://jobs-eu.hudson.com: tls: …Run Code Online (Sandbox Code Playgroud) 因为无法找出为什么无法通过来连接WebSocket服务器,所以一直在扯头发HTTPS。
因此,我有一台运行vue应用程序的Express 4服务器。它使用wsnpm中的库连接到WebSocket服务器。Nginx是1.10.3。我使用LetsEncrypt保护它。
当我上网时,会收到(在控制台中):
main.js:12与'wss://play.mysite.com:8443 /'的WebSocket连接失败:连接建立错误:net :: ERR_CONNECTION_CLOSED
第12行:
window.ws = new WebSocket(
${tls}://${window.location.hostname}:${port});`
那是wss://play.mysite.com:8443。它确实在子域上。
这是我的nginx方块:
更新:我明白了!
upstream websocket {
server 127.0.0.1:8443;
}
server {
root /var/www/play.mysite.com/dist;
index index.html;
access_log /var/log/wss-access-ssl.log;
error_log /var/log/wss-error-ssl.log;
server_name play.mysite.com www.play.mysite.com;
location /ws {
proxy_pass http://websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
listen [::]:443 ssl ipv6only=on default_server; # managed by Certbot
listen 443 …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Charles将我的服务器请求映射到Mac上的localhost.服务器使用HTTPS,本地是HTTP.我正在尝试使用Chrome浏览器,iOS模拟器和Postman.它总是失败.
我map remote从查尔斯my-server.com/*开始http://localhost:PORT.如果我尝试https://my-server.com/,查尔斯映射请求,但我在CONNECT请求中收到错误.如果我尝试http://my-server.com,请求成功.
编辑:有一个答案暗示rewrite而不是map remote.这是好的和有效的,但我觉得这是一种解决方法.我map remote想像往常一样使用.我想这需要Charles设置和机器设置
我尝试了https://myserver.com/~username=username&password=mypassword,但是它不起作用。
您能否确认可以通过HTTPs参数(GET或POST)传递用户/传递?
基本上,我想访问此链接https://www.globalnorm.net/gn/doc.php?name=ASTM%20F%202638:2012-00&erx=0(但我需要进行身份验证)如何传递我的用户名和URL中的密码?