Fixing yaml loading warnings, checking if bill is already in nextcloud
This commit is contained in:
parent
f3c3fd231c
commit
4450c6e07d
@ -10,8 +10,8 @@ try:
|
||||
except NameError:
|
||||
pass
|
||||
|
||||
conf = yaml.load(open('creds.yml'))
|
||||
user = conf['nextcloud']['username']
|
||||
conf = yaml.load(open('creds.yml'), Loader=yaml.SafeLoader)
|
||||
username = conf['nextcloud']['username']
|
||||
password = conf['nextcloud']['password']
|
||||
client = ovh.Client()
|
||||
bills = client.get('/me/bill')
|
||||
@ -24,6 +24,17 @@ for bill in bills:
|
||||
f.write(r.content)
|
||||
f.close()
|
||||
url += bill + ".pdf"
|
||||
with open('/dev/null','wb') as output:
|
||||
c = pycurl.Curl()
|
||||
c.setopt(c.URL, url)
|
||||
c.setopt(c.USERPWD, '%s:%s' %(username, password))
|
||||
c.setopt(c.CUSTOMREQUEST, 'PROPFIND')
|
||||
c.setopt(c.WRITEDATA, output)
|
||||
c.perform()
|
||||
status = c.getinfo(c.RESPONSE_CODE)
|
||||
c.close()
|
||||
output.close()
|
||||
if (status == 404):
|
||||
file = open(file_path)
|
||||
c = pycurl.Curl()
|
||||
c.setopt(c.URL, url)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user