Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: Subprocess call with wget - Scheme Missing

Tags:

python

wget

jira

I'm trying to trying to run the command wget from within a python script. The follow wget works perfectly fine when just entering it on the command line, but it gives me a scheme missing error when I try to do it with

subprocess.call([])

I'm not too sure how to fix it, I've tried all the solutions from other questions but none of them seem to work.

FILTER_ID = 10000
USERNAME = 'myusername'
PASSWORD = 'mypassword'

JIRA_URL = '"https://myjiraserver.com/sr/jira.issueviews:searchrequest-excel-all-fields/%d/SearchRequest-%d.xls?tempMax=1000&os_username=%s&os_password=%s"' % (FILTER_ID, FILTER_ID, USERNAME, PASSWORD)

OUTPUT = 'jira_issues.xls'
PARAMETER = '--no-check-certificate'
subprocess.call(['wget', '-O', OUTPUT, JIRA_URL, PARAMETER])

I was wondering if making it double quotes or single quotes makes a difference, so I tried both ways and it still gives me the same error. Is subprocess.call the way to go?

Thank you in advance. :)

like image 486
watchingdogs Avatar asked May 01 '26 03:05

watchingdogs


1 Answers

Try removing the quotes from the JIRA_URL. You don't need to use quotes to group arguments to subprocess.call, since they're already split into the list of arguments you pass in.

FILTER_ID = 10000
USERNAME = 'myusername'
PASSWORD = 'mypassword'

# No extra quotes around the URL
JIRA_URL = 'https://myjiraserver.com/sr/jira.issueviews:searchrequest-excel-all-fields/%d/SearchRequest-%d.xls?tempMax=1000&os_username=%s&os_password=%s' % (FILTER_ID, FILTER_ID, USERNAME, PASSWORD)

OUTPUT = 'jira_issues.xls'
PARAMETER = '--no-check-certificate'
subprocess.call(['wget', '-O', OUTPUT, JIRA_URL, PARAMETER])
like image 122
AA A Avatar answered May 02 '26 17:05

AA A