I want to add value to receive input from the user to the header .
But, An error occurs due to two variables(x_user, x_key) when declare a variable header .
1. Stored in list the user data in file.csv
command of input is
ID = input("input the customer email id: ")
cList(ID)
def cList(value):
with open(DIR, newline='') as f:
data = csv.reader(open(DIR, "r"))
for row in data:
MEM_ID = row[0]
MEM_SQ = row[1]
X_AUTH_USER = row[2]
X_AUTH_KEY = row[3]
X_STORAGE_URL = row[4]
ACCESSKEY = row[5]
2. It assigns the variables to the function.
aList( X_AUTH_USER, X_AUTH_KEY)`
3. Function of aList used the pycurl module.
def aList(x_user, x_key):
headers = ['X-Storage-User:'x_user, 'X-Storage-Pass:'x_key]
pycurl_connect = pycurl.Curl()
pycurl_connect.setop(pycurl.CAINFO, certifi.where())
pycurl_connect.setopt(pycurl.URL, STORAGE_URL)
pycurl_connect.setopt(pycurl.HTTPHEADER, headers)
pycurl_connect.setopt(pycurl.WRITEFUNCTION, bodycb)
pycurl_connect.setopt(pycurl.HEADERFUNCTION, headercb)
pycurl_connect.perform()