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...
(Python) How would I add this input into my code? "Enter Y for Yes or N...
(Python) How would I add this input into my code? "Enter Y for Yes or N for No:" as a loop. def getMat(): mat = np.zeros((3, 3)) print("Enter your first 3 by 3 matrix:") for row in range(3): li = [int(x) for x in input().split()] mat[row,0] = li[0] mat[row,1] = li[1] mat[row,2] = li[2] print("Your first 3 by 3 matrix is :") for i in range(3): for k in range(3): print(str(int(mat[i][k]))+" ",end="") print() return mat def checkEntry(inputValue): try: float(inputValue) except...
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...
My add method is not working to add elements into an arrayList in java. This is...
My add method is not working to add elements into an arrayList in java. This is the error message I keep getting: Exception in thread "main" java.lang.NullPointerException    at assignment1.ArrayBag.add(ArrayBag.java:50)    at assignment1.Main.main(Main.java:21) BUILD FAILED (total time: 0 seconds) The following are all the methods I've created. /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package...
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.
**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
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT