Question

In: Computer Science

my question is in python. My question is how to add post users to post gres...

my question is in python.
My question is how to add post users to post gres in python

Solutions

Expert Solution

HOW TO ADD POST USERS TO POST GRES IN PYTHON:  

The users of Postgres, to add the new users to the database, send that new user confirmation email, receive a response from their link and set a flag in the PostgreSQL database that the user is confirmed. It is compared with the hash in PostgreSQL database. Using Python and PostgreSQL the final updating of the database is send back to the login screen.

import psycopg2
from psycopg2 import sql
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT 

con = psycopg2.connect(dbname='postgres',
      user=self.user_name, host='',
      password=self.password)
      

con.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)


cur = con.cursor()

# Use the psycopg2.sql module instead of string concatenation 
# in order to avoid sql injection attacs.
cur.execute(sql.SQL("CREATE DATABASE ()").format(
        sql.Identifier(self.db_name))
    )
    

Related Solutions

Please add to this Python, Guess My Number Program. Add code to the program to make...
Please add to this Python, Guess My Number Program. Add code to the program to make it ask the user for his/her name and then greet that user by their name. Please add code comments throughout the rest of the program If possible or where you add in the code to make it ask the name and greet them before the program begins. import random def menu(): print("\n\n1. You guess the number\n2. You type a number and see if the...
I need a answer to my professors question about my discussion post My Post 1) What...
I need a answer to my professors question about my discussion post My Post 1) What types are protected? Under the National Labor Relation Act, an employee's right to strike is a considered as a critical component of the right to organize. But to ensure balance this right is not without limitations. As per Section 7 of NLRA only Certain strikes qualify as protected activity. These recognized strikes are: ·         Unfair labor practice strikes, which protest employers illegal activities. ·        ...
ATTN: This is my second time having to post this question. This is a multi-part question...
ATTN: This is my second time having to post this question. This is a multi-part question consisting of 2 parts: part A, consisting of 5 sub-sections and part B, consisting of 3 sub-sections. Both parts and all sub-sections are dependent upon the same data, making this one multi-part question. Chegg policy states that multiple questions within one post are not allowed however, questions with multiple sub-parts are allowed. Since this is only one question with multiple sub-parts, given that part...
Python I want to name my hero and my alien in my code how do I...
Python I want to name my hero and my alien in my code how do I do that: Keep in mind I don't want to change my code except to give the hero and alien a name import random class Hero:     def __init__(self,ammo,health):         self.ammo=ammo         self.health=health     def blast(self):         print("The Hero blasts an Alien!")         if self.ammo>0:             self.ammo-=1             return True         else:             print("Oh no! Hero is out of ammo.")             return False     def...
I'm making a python program that checks the users input. If the users input does not...
I'm making a python program that checks the users input. If the users input does not match the rules then the program will output "No". If the users input does match the rules it will output "Yes". The rules are : at least 5 uppercase letters at least 5 lowercase letters at least 5 numbers No more than 20 characters in total I have managed to meet these conditions in individual python files but not in one. Ideally without importing...
I'm making a python program that checks the users input. If the users input does not...
I'm making a python program that checks the users input. If the users input does not match the rules then the program will output "No". If the users input does match the rules it will output "Yes". The rules are : 5 uppercase letters 5 lowercase letters 5 numbers First letter must be capitilized The total characters must be 15 I have managed to meet these conditions in individual python files but not in one. Ideally without importing anything, still...
What's wrong with my Python code. We have to find the regularexpression in Python My output...
What's wrong with my Python code. We have to find the regularexpression in Python My output should look like this My IP address 128. 0. 0. 1 My IP address 53. 20. 62. 201 My code ipAddresses = [] ipRegEx = re.compile(r"\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}")    result = myRegEx.find all(Search Text)    def Regular_expression(ipAddresses)       for i in ipAddresses:          print(i) ipSearchResult = ipRegEx.search(line)    if ipSearchResult != None and ipSearchResult.group() not in ipAddresses:       ipAddresses.append(ipSearchResult.group()) we have to use loop too.
Python Question 5 (Multiple Choice) msg1 = "My favorite number is " + str(fav_num) + "."...
Python Question 5 (Multiple Choice) msg1 = "My favorite number is " + str(fav_num) + "." msg2 = "My favorite number is "+str(fav_num)+"." Why would msg1 be preferred over msg2 (a)The user output is easier to read (b)The code is easier to read. (c)Both a and b Question 6 Given this list: pets = ['teddy', 'jessie', 'skippy'] Be sure to refer to the list element by its index Write the python statement whose output is: Hello SKIPPY; you are a...
**Add comments to existing ARM code to explain steps** Question that my code answers: Write an...
**Add comments to existing ARM code to explain steps** Question that my code answers: Write an ARM assembly program to calculate the value of the following function: f(y) = 3y^2 – 2y + 10 when y = 3. My Code below, that needs comments added: FunSolve.s LDR R6,=y LDR R1,[R6] MOV R2,#5 MOV R3,#6 MUL R4,R1,R1 MUL R4,R4,R2 MUL R5,R1,R3 SUB R4,R4,R5 ADD R4,R4,#8 st B st y DCD 3
This is a discussion question for my csc 252 computer programming c++ visual studio so post...
This is a discussion question for my csc 252 computer programming c++ visual studio so post in c++ visual studio so that i can copy and paste thank you. In Object Oriented Programming, classes represent abstractions of real things in our programs. We must quickly learn how to define classes and develop skills in identifying appropriate properties and behaviors for our class. To this end, pick an item that you work with daily and turn it into a class definition....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT