This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You have been given a sample data and the list of selected values. Your task will be to make the query for mongo collection. | |
// this is the sample value | |
let unique_fields = [ | |
{"key":"priority","operator":["==","!="],"type":"str","value":["normal","high","low","urgent"]}, | |
{"key":"status","operator":["==","!="],"type":"str","value":["open","pending"]}, | |
{"key":"account_domain","operator":["==","!="],"type":"str","value":["renault.co.in","rivian.com","lucidmotors.com", | |
"mercedes-benz.com","zoox.com","tata.com","bmw.com","kia.com","tesla.com","honda.com","toyota.com"]} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>SIYA | Dashboard </title> | |
<head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. What will happen if the rate limit strings that are provided to the Limiter.limit() decorator are malformed and can’t be parsed ? | |
Answer: Then the decorated route will fall back to the default rate limit(s) and an ERROR log message will be emitted. | |
2. What is exemption condition? | |
Answee: Each limit can be exempted when given conditions are fulfilled. These conditions can be specified by supplying a callable as an `exempt_when` argument when defining the limit. | |
3. What is key_func ? | |
Answer: key_func is a callable that returns the domain to rate limit by. | |
4. What is exempt? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. How can we set up Mail instance using init_app method | |
Answer: Use below command: | |
mail = Mail() | |
app = Flask(__name__) | |
mail.init_app(app) | |
2. Why 'ConnectionRefusedError:[WinError 10061]' occurs and how to fix it? | |
Answer: Based on the description of the error, this is not a problem with your Python code, but rather that the network connection to smtp.gmail.com is being blocked/rejected (possibly by a firewall or some other network issue). | |
Note that if you are running this on a home machine, most ISPs will actively block outbound SMTP connections to anything except the ISP's own SMTP servers (some hosting providers also do the same), to prevent spammers from exploiting the service. You may need to change your settings to use your ISP's outbound mail host instead of connecting directly to smtp.gmail.com. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. How can we hide the MongoDB connection details from our code ? | |
Answer: Use an environment variable. | |
2. What is dotenv used for? | |
Answer: dotenv allows you to separate secrets from your source code. This is useful in a collaborative environment (e.g., work, or open source) where you may not want to share your database login credentials with other people. Instead, you can share the source code while allowing other people to create their own . env file. | |
3. What is dotenv package? | |
Answer: DotEnv is a lightweight npm package that automatically loads environment variables from a . env file into the process. ... To use DotEnv, first install it using the command: npm i dotenv . | |
4. How can we access the variable or string that is hidden using dotenv ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. How do I deploy a Python app to Heroku? | |
Answer: Deployment Steps | |
a) Login to your Heroku account using CLI. ... | |
b) Create a web app on Heroku. ... | |
c) Create requirements.txtfile in the same project directory. ... | |
d) Create a Procfile. ... | |
e) Create runtime.txt to specify the Python version at runtime. ... | |
f) Initialize an empty git repository and push the code. | |
2. How do I deploy an existing app to Heroku? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. What is Procfile in node? | |
Answer: Procfile is a mechanism for declaring what commands are run by your application's dynos on the Heroku platform. | |
2. How do I run a Procfile locally? | |
Answer: To start your app locally follow the below steps: | |
a) To use a different Procfile, use the -f flag: heroku local -f Procfile. test . | |
b) To use a different environment file, use the -e flag: heroku local -e . env. test . | |
c) To use a different port, use the -p flag: heroku local -p 7000 . If you don't specify a port, 5000 is used. | |
3. Where do I put Procfile? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Who can make request? | |
Answer: Anyone who has access to the computer running the app can make request. | |
2. What is Dynos? | |
Answer: The containers used at Heroku are called “dynos.” Dynos are isolated, virtualized Linux containers that are designed to execute code based on a user-specified command. ... Dynos are the building blocks that power any Heroku app, from simple to sophisticated. | |
3. Why is Heroku useful? | |
Answer: Heroku is useful because: | |
a) We can put our code in their servers | |
b) We can run our flask apps continuously |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. What is requirement file? | |
Answer: A requirements file is a list of all of a project's dependencies. This includes the dependencies needed by the dependencies. It also contains the specific version of each dependency, specified with a double equals sign ( == ). | |
Logically, a Requirements file is just a list of pip install arguments placed in a file. Note that you should not rely on the items in the file being installed by pip in any particular order. | |
2. Why we need requirement.txt? | |
Answer: It helps us in several ways, even when we revisit our project in the future, as it solves almost all compatibility issues. If you ever work on any Python project or developed any project, you surely know that we usually require several numbers of packages. However, while developing a project, we generally used a particular version of packages. Later on, the package manager or maintainer may make some changes, and these modifications can easily break your entire application. Therefore it is too much work to keep track of e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. What is Flask? | |
Answer: Flask is a light-weight web framework. With Flask, you get to pick-and-choose what components and extension needed for your site. I like this aspect since the modular nature allows you to build everything up, without too much clutter. | |
2. What is app Factory Flask? | |
Answer: The Flask Application Factory refers to a common "pattern" for solving this dilemma. ... For Flask to recognize the data models we have in models.py , our Blueprints, or anything else, Flask needs to be told that these things exist after the app is "created" with app = Flask(__name__) . | |
3. How can we use Flask's app Factory pattern in our code? | |
Answer: Just wrap your code under the following command | |
def create_app(): | |
#Your app.py code |
NewerOlder