This commit is contained in:
Kirby 2020-12-13 14:44:00 +01:00
parent f81c156097
commit b762463de9

View File

@ -2,8 +2,8 @@
import requests import requests
import ovh import ovh
import pycurl
import yaml import yaml
import pycurl
try: try:
input = raw_input input = raw_input
@ -24,7 +24,7 @@ for bill in bills:
f.write(r.content) f.write(r.content)
f.close() f.close()
url += bill + ".pdf" url += bill + ".pdf"
with open('/dev/null','wb') as output: with open('/dev/null', 'wb') as output:
c = pycurl.Curl() c = pycurl.Curl()
c.setopt(c.URL, url) c.setopt(c.URL, url)
c.setopt(c.USERPWD, '%s:%s' %(username, password)) c.setopt(c.USERPWD, '%s:%s' %(username, password))
@ -34,7 +34,7 @@ for bill in bills:
status = c.getinfo(c.RESPONSE_CODE) status = c.getinfo(c.RESPONSE_CODE)
c.close() c.close()
output.close() output.close()
if (status == 404): if status == 404:
file = open(file_path) file = open(file_path)
c = pycurl.Curl() c = pycurl.Curl()
c.setopt(c.URL, url) c.setopt(c.URL, url)