How to use 'run curl command in python' in Python

Every line of 'run curl command in python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
21def ccurl(url):
22 hdr = "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:37.0) Gecko/20100101 Firefox/37.0"
23
24 content = subprocess.check_output(['curl','-L','-A',hdr,url])
25 if isinstance(content,bytes):
26 print("I'm byte")
27 try:
28 content = str((content).decode('utf-8'))
29 except:
30 content = str(content)
31 else:
32 print(type(content))
33 content = str(content)
34 print("I'm unicode")
35
36 return (content)
26def CMD(script, url, file):
27
28 cmd = 'node "%(script)s" -s "%(url)s" -f "%(file)s"' % {
29 'script': script,
30 'url': url,
31 'file': file,
32 }
33
34
35 subprocess.call(cmd, shell=True)
36
37 pass

Related snippets