M
M
Mikhail Osin2018-09-26 11:18:09
Python
Mikhail Osin, 2018-09-26 11:18:09

How to pull all urls from the list!?

I have a function that generates a certain number of urls for setting permissions via api.
I can't figure out how all these urls can be called using the POST method to set the necessary permissions.
P.S. No way to use requests

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osin, 2018-09-27
@Telsir

# Defying keylist from 1st url
def keylist():
urls = []
for x in data["values"]:
formattedUrl = furl.format((x["key"]))
print(formattedUrl)
urls.append(formattedUrl)
return urls
urls = keylist()
# Defying put request
def putUrls():
for x in urls:
credentials = base64.b64encode(f"{username}:{password}".encode()).decode("ascii")
headers = {'Authorization': "Basic "+credentials}
req = urllib.request.Request(url='{}'.format(x), method='PUT', headers=headers)
urllib.request.urlopen(req)
putUrls()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question