Python Flask search and retrieve data from mysql xampp - python

I cant fetch data from the DB. And I don't know whether the program is getting the data from the search bar
Search for a data in db and displaying it in the html page

Related

Change Data source in PowerBI according to userid entered in django html form

I am developing a web app in Django which takes user information and an excel file as input(the user fills out a form and uploads an excel file). The data from that excel file is extracted and stored in an SQL database. The extracted data is fed to an optimization model which produces a result that is stored in a separate excel file in an Amazon S3 bucket. The naming of the output excel file is unique(name contains userid).
I want my PowerBi dashboard to connect to the output file depending on who is logged in to the Django web app ie get the userid from the web app search if the file containing that userid is present in the Amazon S3 bucket and if it is, connect that excel file to PowerBi dashboard, then embed that dashboard to a separate web page in Django, so that the specific user can see the visualizations.
I went through multiple Powerbi articles, I know we can connect files in S3 to Powerbi using a custom python script, but don't know how to do it dynamically or even how to get the userid from the form and search the S3 bucket.
Can anyone please let me know if it's possible? or are there any other ways to do the same?
(To make it worse I am a beginner in Django and Powerbi)

Connecting Bootstrap search box with Python based search engine

I am attempting to integrate Elasticsearch as a search engine for my static website. I use the Python package "Lektor" as my static website generator. I have been able to automate indexing all my webpages into Elasticsearch. Additionally, I am using Bootstrap to have a navigation bar on the top of the website. I have added the relevant search bar code from Bootstrap and it looks exactly like I want it to. My issue is with connecting the Bootstrap search bar to my Python code that queries the Elasticsearch cluster I have set up. I am hoping to process the search bar data and send it as an argument to my Python querying function. Is this possible? I know how to do this with Flask and setting up an endpoint, but in this case, I do not know how to set a specific endpoint for search that reacts to the search bar's form data.

Using Python Django how could I do custom function, save to db and return json response

I created a scraper and want to integrate it with API. Starting with Python Django is great and offers easy start, but I am having trouble with the following structure of code:
GET request on /test
Scrape data
Save data to db
Return data as a response
Basically I am having trouble with saving data of a list in database and returning that data as response. Scraper would be in another python file in utils.py and api would call a function and it would return list of scraped data
Does anyone have an example of what I am trying to achieve?
You might use a custom django-admin command. You might be able to access all of your models as if you were developing a view. And you can trigger your command with ./manage.py mycustomcommand.

How to store data scraped by BeautifulSoup on GAE?

My site is able to log in to a 3rd party secured website by using gaemechanize and scrape data by using BeautifulSoup. After log in successfully, if I refresh pages, sometimes, the data will be gone so that "500 Internal Server Error" page will appear; however, sometimes, the data will be stored unexpectedly and those data is shown on other computer without login.
My question is How to store data until user click logout and the only one session can access the data?
Use WebApp2 to use Sessions, and store data to that session. Once the user logs out, you can store the data to the datastore permanently or just kill the session and let the data for that session disappear.
Check out WebApp2 sessions: http://webapp-improved.appspot.com/api/webapp2_extras/sessions.html

Oracle connectivity for Selenium using Python

I am using selenium with Python.
I recorder the test case and able to run it properly.
Now the web page I am using is connect with oracle server and some details thae need to be provide in Web page is required to fetch from oracle DB.
So can you please help that how to fetch data from oracle and fill the web page details automatically in selenium
Thanks in advance.
You will need to ask the people who wrote the application how you can connect to the Oracle database. They can provide you with the database schema, the connection URL with user name and password.
After that, you need to add the Oracle driver to your Selenium project and create helper classes to fetch data from the database. Use those helper classes in your page object.
This page contains links to Python drivers for Oracle.

Categories

Resources