S
S
SoulHunter0332021-06-22 19:49:44
Python
SoulHunter033, 2021-06-22 19:49:44

How to pull text from sqlite3 tuple?

Hello everyone! I have a problem. I need to fetch links from the database of the url column, and then send a request to them via requests , but I get an error

No connection adapters were found for "('https://www.sahibinden.com/renault-fluence?sorting=date_desc',)"

I googled, this is because there are brackets and quotes. So the question is how to get a link from the database in its purest form? without brackets, commas, etc.? My code:
db = sqlite3.connect('database.db')
  cursor = db.cursor()
  query = """SELECT url FROM userdata"""
  cursor.execute(query)

  for url in cursor:

    r = requests.get(url=url, headers=headers)
    soup = BeautifulSoup(r.text, "lxml")

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2021-06-22
@SoulHunter033

url[0]
tin...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question