I tried installing poplib on my Mac, I tried with Conda, pip and Homebrew, but I couldn't manage to install this module.
Do you have any suggestion that I can try or an alternative module?
I'm using Python 3.5.1 installed with Anaconda.
Thanks!
I solved using impalib,and resolved an error with smtplib, but now I got even more stuck...
I cannot authenticate with the smtp server and cannot connect to the imap server.
This is my code:
class EmailController:
def __init__(self):
# Check for connection, connect to servers.
internetConnection = requests.get('http://www.google.com')
while not internetConnection:
internetConnection = requests.get('http://www.google.com')
self.addrFrom = 'My address'
print('connecting smtp')
self.smtpServer = smtplib.SMTP('smtp-mail.outlook.com', 587)
print('starting tls')
self.smtpServer.starttls()
print('authenticating')
self.smtpServer.login(self.addrFrom, 'password') #Here it gets stuck
print('connecting imap')
self.imapServer = imaplib.IMAP4('imap-mail.outlook.com', 993) #Here is gets stuck too
print('starting tls')
self.imapServer.starttls()
Could it be the server or I'm doing something wrong? Ho do you start SSL encryption on imaplib?
Related
I use RStudio from an AWS EC2 Windows. To get .pdf file from my rmarkdown I tried to install MiKTeX on my EC2 and faced some issue, so I decided to try the tinytex solution. I correctly installed the tinytex package but I had some trouble to install tinytex from it. For your info, following security reasons only selected websites are whitelisted. So to be able to install tinytex I asked for whitelisting:
yihui. org
miktex. org
ci.appveyor. com
www.ctan. org
but I still can't get tinytex installed on my EC2 Windows. I also downloaded separetely TinyTeX.zip to install it but tinytex:::install_windows_zip() is not available anymore.
When I try tinytex::install_tinytex() I got the following error:
trying URL 'https://yihui.org/tinytex/TinyTeX-1.zip'
trying URL 'https://yihui.org/tinytex/TinyTeX-1.zip'
trying URL 'https://yihui.org/tinytex/TinyTeX-1.zip'
Error in xfun::download_file(..., quiet = Sys.getenv("APPVEYOR") != "") :
No download method works (auto/wininet/wget/curl/lynx)
In addition: Warning messages:
1: In download.file(url, output, ..., method = method) :
InternetOpenUrl failed: 'A connection with the server could not be established'
2: In download.file(url, output, ..., method = method) :
URL 'https://appveyorcidatav2.blob.core.windows.net/yihui-27038/tinytex/1-0-1628/31j2ygh3xv2sk7xd/TinyTeX-1.zip?sv=2015-12-11&sr=c&sig=HJOnYMwO2zT2iFAlwT859FH53nzIHB0oV2RslIq990g%3D&st=2021-08-05T14%3A40%3A04Z&se=2021-08-05T14%3A46%3A04Z&sp=r': status was 'SSL connect error'
3: In download.file(url, output, ..., method = method) :
InternetOpenUrl failed: 'A connection with the server could not be established'
I am not sure to understand the error message, should I ask for whitelisting another websites?
Thanks in advance for any assistance on that.
Mhd
Another of of these questions, I know this question has been asked (and answered) a lot on StackOverflow, but I can't get any of those to work for me and I also have a few questions I would like to learn.
Here is my error:
OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A
To start, here is my system settings.
I am on OSX El Capitan version 10.11.6
openssl version
OpenSSL 0.9.8zh 14 Jan 2016
which openssl
/usr/bin/openssl
ruby -v
ruby 2.1.6p336 (2015-04-13 revision 50298) [x86_64-darwin14.0]
rbenv -v
rbenv 0.4.0
My questions are these:
1) Does this error mean that a certificate was sent back to me, and then my OpenSSL version was unable to verify it? Did the other server have a chance to read mine, or even see it yet? Is there a way to dig into this request using Net::HTTP and inspect this other than opening up a program like Wireshark? Once I call net::HTTP.new.request(request) I seem to lose control and it just errors.
2) Did I even successfully talk to the other server, and it denied me?
3) At what point in the request am I in when I get this message?
and most of all
4) What are my options to get past this point
4a. So far i'm seeing a possible brew solution, but I haven't been able to get brew to link
4b. I could manually install Mozilla's CA (Or any other CA) into my Mac OSX Keychain
4c. Can I attach the file using the request.ca_file = "file" as I tried in my code? (see below)
4d. Is there any other solutions / best and most politically correct version?
5) Am I going to have this issue when I deploy to Heroku?
From what i'm reading, this is an issue of my OS not containing the correct CA files. the ca_file part is due to my first attempts to add the correct ca_file to my requests. I'm guessing I don't need that. I am using a Proxy with heroku because this API requires a static IP.
Here is my generic code
cert = File.read(File.join(Rails.root, 'ssl', 'test_env', 'their_test_cert.der'))
ca_file = File.read(File.join(Rails.root, 'ssl', 'test_env', 'Class3PublicPrimaryCA.der'))
uri = URI("https://xml.theirtestenv.com/api/receive")
headers = {
'x-IK-Version' => 'IKR/V4.00',
}
proxy_host = "myproxyhose"
proxy_port = "1234"
proxy_user = "myproxyuser"
proxy_pass = "myproxypass"
proxy_request = Net::HTTP.new(uri.hostname, '443', proxy_host, proxy_port, proxy_user, proxy_pass)
# http.key = OpenSSL::PKey::RSA.new(rsa_key)
proxy_request.use_ssl = true
proxy_request.cert = OpenSSL::X509::Certificate.new(cert)
proxy_request.ca_file = ca_file
proxy_request.verify_mode = OpenSSL::SSL::VERIFY_PEER
# proxy_request.ssl_version = :SSLv3
# This doesn't seem to matter whether I put this or not...
# Tried variations of these...
# proxy_request.ssl_version = :TLSv1
# proxy_request.ciphers = ['DES-CBC3-SHA']
post_request = Net::HTTP::Post.new(uri, headers)
post_request.content_type = "multipart/related"
response = proxy_request.request(post_request)
puts response.inspect
Also, i've noticed no matter what proxy_requst.ssl_version I put, my error always specifies SSLv2/v3, does that mean on their end they are requiring that version?
Sorry for all the questions. Thanks in advance
It's been awhile, but I just wanted to post that this was a couple of issues, the certificates I was passing were not the correct ones they were for the wrong environment. Once the correct certificates were passed this started working, though I never got the SSL Version questions quite figured out.
I've searched in the archive but could not find an answer to my dilemma. I'm coding in Ruby and using watir webdriver framework on my local Mac Yosemite and want to connect to postgres database on a linux box.
I have the required ruby gems installed on my local Mac
* LOCAL GEMS *
dbd-pg (0.3.9)
pg (0.18.4)
dbi (0.4.5, 0.4.4)
I am using the following code.
require 'rubygems'
require 'pg'
require 'dbd/pg'
require 'dbi'
conn = PGconn.connect("10.0.xx.xx","5432",'','',"mydbname","dbuser", "")
res = conn.exec('select * from priorities_map;')
puts res.getvalue(0,0)
conn.close if conn
On running this
I a getting these errors
.initialize': Could not connect to server: Connection refused (PG::ConnectionBad)
Is the server running on host "10.0.xx.xx" and accepting
TCP/IP connections on port 5432?
If I use the code
dbh = DBI.connect("dbi:pg:mydbname:ipaddress", "user", "")
row = dbh.exec('select * from etr_priorities_map;')
puts row.getvalue(0,0)
dbh.disconnect if dbh
I get the error
block in load_driver': Unable to load driver 'pg' (underlying error: wrong constant name pg) (DBI::InterfaceError) from System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
I am new to Ruby. How can I resolve these issues?
The first error, as #Doon said in the comments, comes from the TCP connection and usually means your database is not listening on the network. Most PostgreSQL packages come with a default configuration that only allows local connections, but you can enable connections over the network in the server configuration via the listen_addresses setting. I installed PostgreSQL through Homebrew on my Mac, and my config is at /usr/local/var/postgres/postgresql.conf, but if you installed it some other way the path may be different.
The second error is happening because the "driver" part of the connection string is case-sensitive, and the DBD driver for Postgres is named Pg, not pg. Try this:
dbh = DBI.connect("dbi:Pg:mydbname:ipaddress", "user", "")
Also, unless you have your heart set on using Ruby/DBI, you might want to consider using a more-recently maintained library. Ruby-DBI is very well-written and tested, but it hasn't seen a release since 2010, and Ruby itself has changed pretty significantly in the interim.
If you do want to consider alternatives, I use Sequel for mostly everything, and I highly recommend it, especially for Postgres development, but both DataMapper and ActiveRecord have a large userbase as well.
I have installed predictionio through brew on my osx ( Maverick ) and i can start the admin's service (http://0.0.0.0:9000 ) and the api's server (http://0.0.0.0:8000).
But reading the docs, with the ruby's sdk, says:
# Create a client object.
client = PredictionIO::EventClient.new(<ACCESS KEY>, <URL OF EVENTSERVER>)
At first, i have inserted the api's url, but reading other docs ( like the python's sdk ) says that the eventserver runs on http://0.0.0.0:7070.
If i try to create a event:
client.create_event('rate', 'user', rate.user_id, { 'targetEntityType'=> 'item', 'targetEntityId' => rate.rateable_id, 'properties'=> {'rating'=> 3 }})
it always return the same response: 'PredictionIO::EventClient::NotCreatedError: Your request is not supported'
The guide says that the command to run this server is:
pio eventserver
But I don't have this bin. I start everything with the script 'predicitonio-start-all.sh' but with this I can't start this event server.
Thanks in advance !!
The Homebrew script is maintained by community and has not yet been updated to 0.8.4 yet. It is using 0.7.3 (http://braumeister.org/formula/predictionio) which does not work with the current documentation.
Please follow the instructions here to install the latest version: http://docs.prediction.io/install/
I got the error on ubuntu but works on mac
But if I run the curl command on ubuntu , it works. is curb a buggy gem?
2.1.0/gems/curb-0.8.6/lib/curl/easy.rb:72:in `perform': SSL peer certificate or SSH remote key was not OK (Curl::Err::SSLPeerCertificateError)
RUBY
resp = Curl::Easy.http_post(server_url, content_to_send) do |curl|
curl.ssl_verify_peer = false
curl.headers = header.clone
end
Detail
/home/poc/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/curb-0.8.6/lib/curl/easy.rb:72:in `perform': SSL peer certificate or SSH remote key was not OK (Curl::Err::SSLPeerCertificateError)
from /home/poc/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/curb-0.8.6/lib/curl/easy.rb:398:in `http_post'
from /home/poc/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/curb-0.8.6/lib/curl/easy.rb:398:in `http_post'
from curb.rb:12:in `curl_query'
from curb.rb:21:in `<main>'
I had the same error, turns out for linux machines you need ssl_verify_host=0
To be safe I use both:
resp = Curl::Easy.http_post(server_url, content_to_send) do |curl|
curl.ssl_verify_peer = false
curl.ssl_verify_host = 0
curl.headers = header.clone
end
Also a heads up—you might be developing on mac, but deploying to a server running linux, so better to use both even on a mac.