0

I have this url www.example.com. I need to send this url in scrapy Request method,How can I attain that? url_final = https://www.example.com/sch/i.html?_from=R40&_trksid=m570.l1313&_nkw=MYSEARCHKEY&_sacat=0

url = 'httpss://www.example.com/'
MYSEARCHKEY = 'MYSEARCHKEY'
yield Request(url_final, callback=self.parse_new)
Praveen
  • 74
  • 1
  • 12
  • 2
    Possible duplicate of [Add params to given URL in Python](https://stackoverflow.com/questions/2506379/add-params-to-given-url-in-python) – Mike Scotty Feb 22 '19 at 12:02

1 Answers1

0

You can use python library for urlencoding to create final URL.

from urllib.parse import urlencode
params={'_from':'R40',
        '_trksid':'m570.l1313',
        '_nkw':'MYSEARCHKEY',
        '_sacat':0}
base_url=' https://www.example.com/sch/i.html'
final_url= '{}?{}'.format(base_url,urlencode(params))
Gautam Kumar
  • 525
  • 4
  • 9