KIbana connection and ES integration using python - python

This project basically involved Elasticsearch cloud and Kibana, and Python client as well. Currently, I am stuck trying to add an index pattern to Kibana from ES. I found some helpful functions by pybana such as "update_or_create_default_index_pattern" but nothing related to Kibana connection.
I would appreciate it if someone have ever worked with this tool using python (or whatever programming language)
Thank you

You can use the kibana index pattern API.
With the python requests package (or any other HTTP library), you can create an HTTP request for creating the index pattern.
Create index pattern API

Related

Get data from Scroll in http request api elasticsearch

I'm trying to write a code in python to get all the data from an api through an http request.
I am wondering if there is a way to use the _scroll_id and it's contents in python. If so, how do I implement it or could you share some documentation regarding it?
All the documentation regarding elasticsearch in python is using a localhost...
Any leads would be highly appreciated.
Elasticsearch has a Python library that helps with pinging the database.
You can use the scan() helper function. Internally, it calls the scroll API so you don't have to worry about any of that.
For the last part of your question, you'd have to follow the tutorial to see how to connect to different databases.
https://elasticsearch-py.readthedocs.io/en/v8.3.3/helpers.html#scan

Accessing MongoDB Database on nodejs server using HTTP GET requests

I have a nodejs server setup on AWS with mongoDB. I want to access the database contents using GET method. There is another application in python which needs to access this database present on AWS. I searched on the internet and came across PycURL but I am not getting how to use it exactly. How to approach with pycURL or what can be an alternate solution?
You can build your restful API that is going to handle those GET requests. You have awesome tutorial (with example that you want on bottom):
https://scotch.io/tutorials/build-a-restful-api-using-node-and-express-4
Edit: If you want phyton code for GET requests there is awesome answer here: Simple URL GET/POST function in Python
Edit 2: Example of how would this work. You first need to code your API how to handle GET request and on what route (example: http://localhost:5000/api/getUsers). Than you want to make GET request to that route using Phyton:
Example:
r = requests.get(url="http://localhost:5000/api/getUsers")
I had a similar problem a while ago, there is a tutorial here here. It can lead you towards your intended direction, the drawback may be that in the tutorial, to issue the http request (if I remember correctly), they used postman but I'm sure you can still use PyCurl.

Generic REST/RPC API for Python (OpenCPU Equivalent)

A coworker and I are currently using OpenCPU to expose analytics we write in R to other applications via a REST API. There has been a need recently to leverage some python libraries in a similar manner. From the OpenCPU description:
OpenCPU is a system for embedded scientific computing and reproducible research. The OpenCPU server provides a reliable and interoperable HTTP API for data analysis based on R. You can either use the public servers or host your own.
Basically we update an R library on the server and it automatically exposes the updated and new functions at REST endpoints. It takes care of marshalling the data from JSON to S3 and then back to JSON. There is no need to manually configure routes with OpenCPU.
My question then, assuming we are operating in a secure environment, is does an equivalent for python exist? I've tried searching but have had little luck thus far.
Thanks!
Have you looked at IPython? I'm not sure about supporting library updates.

Review Board Python Web API

I'm new with using third-party APIs, and I was trying to get the Review Board Web API to work in python.
However, I was confused about 3 things:
from rbtools.api.client import RBClient
client = RBClient('http://localhost:8080/')
root = client.get_root()
My first question: is http://localhost:8080/ the server that is running the ReviewBoard server? Is there some sort of test server that I can use instead of running my own?
Again, I don't have much experience with APIs so I was wondering if I needed to do some form of authentication before making these calls.
Finally, if I must set up my own Review Board server to try out the API. Would it be possible to get some code for a very simple example as to how to make the simplest POST and GET request you can think of with minimal setup if for example my server was running on http://localhost:8080/?
Reference : http://www.reviewboard.org/docs/rbtools/0.5/api/overview/
To answer your first question: the answer seems to be yes although their docs don't make it entirely clear.
Their docs say:
Here is an example of how to instantiate the client, and retrieve the Root List Resource resource:
Before the code snippet your pasted. That makes me think that the url being passed is whatever you're trying to use, e.g., you could have that set up on a networked machine called monty_python running on port 5050, then you would do:
client = RBClient('http://monty_python:5050/')
As for a test server you should check the documentation they have about their Web API.
Their examples don't seem to show any authentication being performed in the overview. If you check in other sections (e.g., Tutorial: Creating a Pull Request) you'll see them demonstrate how to authenticate and what can be done after authenticating.
As for your last question, I'm not 100% sure what you're asking, but you should probably check the docs I found for their Web API

How to use whois in google app engine

I know there is pywhois but it can't used in gae, see this question. But i really need this function to verify whether a domain is registered, is there other way to implement whois by pure python? Thanks.
You need to find a HTTP Api to get whois like http://www.whoisxmlapi.com/ and with urlfetch you can fetch informations.
An another solution is to create this webservice with a micro instance from AWS and install the module pywhois, you need to just create the interface in HTTP.

Categories