Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I was wondering if I can make a PyMongo client that is not localhost such that I can retrieve data from external computers. Is this possible? I read the documentation but there doesn't anything about it.
Yes, it's possible - just use that external computer hostname or IP address instead of localhost.
For example:
import pymongo
client = pymongo.MongoClient("mongodb://10.20.30.40/")
Another example - I have a MongoDB setup with authentication and multiple nodes in a replica set, so I am using
pymongo.MongoClient(
"mongodb://user:password#host1,host2,host3/dbname?replicaSet=rsname",
read_preference=pymongo.ReadPreference.SECONDARY)
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I need to implement client/server chat application using pure sockets in Python with many different requirements for such a middleware.
The server should serve a small number of clients and I need to decide which sockets should I use TCP and/or UDP. Also I need to implement a multicast.
You can use python's builtin socket module
You should use TCP sockets for this purpose
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm developing an internal business intelligence application that has connections to multiple databases which the user can dynamically define. I need to know what kind of database a connection object is using. How would I do this in python.
You should look at SQLAlchemy to go with python.
This supports a bind feature that allows you to create multiple binds with different databases.
Eg.
SQLALCHEMY_DATABASE_URI = 'postgres://localhost/main'
SQLALCHEMY_BINDS = {
'users': 'mysqldb://localhost/users',
'appmeta': 'sqlite:////path/to/appmeta.db'
}
And if after making the connections/sessions you need info then doing
session.bind.dialect.name
will return the name of the database from the urls added above.
A good gist is available here.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I want to develop a program that can create automatically a gmail account with the use of python.
Is it possible?
If you're looking for a disposable email address, look for such a service with a public API (eg. temp mail). Then use http.client or Python Requests to interact with that API.
If your goal is to create spam or ghost accounts - don't. These services are aimed at quality assurance, ie. testing email services.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
How can I create a client side database to store information of users on client side. Does anybody know of any tutorials or pointers? Which is the recommended database to use? My client is in .js and uses Django framework.
What you are asking for is called Web Storage and is part of HTML5.
http://diveintohtml5.info/storage.html
http://www.gwtproject.org/doc/latest/DevGuideHtml5Storage.html
However, many times when people SAY they need a client-side database, I ask them the details and it turns out that they don't really need client side storage at all, so proceed with caution.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have been writting a socket server in python. I want to send data to some users (no to all) but I dont know how to do it. Can i send it with a for loop?
For example:
some_clients = [client1, client2, client5, client9]
for client in some_clients:
client.send("data")
It is good?
If that works, it's perfectly OK.
If you want something more readable, you could do:
for client in filter(shouldrecieve, all_clients):
client.send(data)
or something like:
for client in (client for client in all_clients if client.attrspam == barfoo):
client.send(data)