V
V
Vanya Smolensky2021-07-08 02:32:52
Python
Vanya Smolensky, 2021-07-08 02:32:52

Syntax error?

Here is the code

import requests
import json
from bs4 import BeautifulSoup

def get_first_market_steam():
  headers = {
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
    'cookie': '_ym_d=1617117545; _ym_uid=161711754528794970; G_ENABLED_IDPS=google; xf_logged_in=1; xf_user=2306008%2C8db46d26a5f78cb04ad8cebd5a7ee6c592170111; timezoneOffset=10800,0; _ga=GA1.1.1292113123.1617117545; xf_last_read_article_date=1617636960; df_id=4edaa88206ca95ffd4e5b6cf693c3d6c; xf_session=eea6a8e176357d0083c7a3df97b42e27; xf_market_items_viewed=14961375%2C15963732%2C15978709%2C15573578%2C15807316; xf_market_search_url=%2Fmarket%2F; _ga_J7RS527GFK=GS1.1.1625692903.224.1.1625700240.0'
  }

  proxies = {
     "http": "http://"
  }

  url = 'https://lolz.guru'
  r = requests.get(url=url, headers=headers, proxies=proxies)

  soup = BeautifulSoup(r.text, 'lxml')
  market_cards = soup.find_all('a', class_='marketIndexItem--Title')

  for market in market_cards:
    market_info = soup.find('div', class_='marketIndexItem--Badges stats').text.stri(p)
    market_rub = soup.find('div', class_='marketIndexItem--Price').text.strip()
    market_badges = soup.find('div', class_='marketIndexItem--Badges').text.strip()
    market_infouser = soup.find('div', class_='marketIndexItem--otherInfo').text.strip()
    market_url = f'https://lolz.guru{market.get("href")}'

    print(f'{market_info} | {market_rub} | {market_url}')


get_first_market_steam()


Why does it give an error that the syntax is incorrect?
line 8
'cookie': '_ym_d=1617117545; _ym_uid=161711754528794970; G_ENABLED_IDPS=google; xf_logged_in=1; xf_user=2306008%2C8db46d26a5f78cb04ad8cebd5a7ee6c592170111; timezoneoffset=10800.0; _ga=GA1.1.1292113123.1617117545; xf_last_read_article_date=1617636960; df_id=4edaa88206ca95ffd4e5b6cf693c3d6c; xf_session=eea6a8e176357d0083c7a3df97b42e27; xf_market_items_viewed=14961375%2C15963732%2C15978709%2C15573578%2C15807316; xf_market_search_url=%2Fmarket%2F; _ga_J7RS527GFK=GS1.1.1625692903.224.1.1625700240.0'
^
SyntaxError: invalid syntax

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2021-07-08
@Animsall

A comma is needed after'user-agent': '...'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question