Closed ghost closed 7 years ago
"Note that only HTTPS proxies work with Pushbullet" can you please modify your code to setup only https proxy?
@kovacsbalu Done. Requests will automatically use the HTTPS proxy if suitable, therefore it doesn't matter if they have a HTTP proxy along side the HTTPS, it'll still use the HTTPS one.
I wonder if the dictionary syntax like here in the example is necessary if only HTTPS proxies are allowed anyway. Or is there a rationale behind this?
Out of interest, where does the HTTPS proxy only requirement come from?
@troeggla: It's explicit, there's multiple types of proxies (SOCKS etc.)
@simonporter007: The API will return a `This server is only accessible over HTTPS.' message if you try to access the API using HTTP.
{"error":{"code":"invalid_request","type":"invalid_request","message":"This server is only accessible over HTTPS.","cat":"(=^‥^=)"},"error_code":"invalid_request"}
Ah I understand, that makes sense! If there are no more concerns, I will merge this.
Right sorry, misunderstood. You can use both http and https proxy addresses but you have to connect to the https endpoint (quite rightly).
Then maybe it does make sense to remove the dictionary syntax? As whatever is passed in should be handed to the https key?
curl --proxy http://proxy.com:8080 --header 'Access-Token: xxxxxxxxxxxxxxxxxxxxxxx' https://api.pushbullet.com/v2/users/me -k
{"active":true,"iden":"xxxxxxxxxxxxx","created":1.41617401377777e+09,"modified":1.479242967034234e+09,......}
curl --proxy http://proxy.com:8080 --header 'Access-Token: xxxxxxxxxxxxxxxxxxxxxxx' http://api.pushbullet.com/v2/users/me -k
{"error":{"code":"invalid_request","type":"invalid_request","message":"This server is only accessible over HTTPS.","cat":"(=^‥^=)"},"error_code":"invalid_request"}
@simonporter007 Well, I think the current syntax is more explicit and should be kept. As an example, it would suck if someone saw the word `proxy' with no protocol specified and bought a non-HTTP proxy (one could argue this is their own fault for not reading the documentation though), I think it would `do more good than harm' so to speak.
@otlie fair point indeed!
Added a
proxy
kwarg to init\() and added an if condition to update session headers w/ specified proxy. See #96