Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- """
- Created on Fri Jul 28 12:04:34 2017
- @author: darcnos
- """
- import requests, json
- def login():
- global siteurl
- siteurl = input('https://')
- #siteurl = 'https://webdocs.fileboundrs.com'
- #print(siteurl)
- #u = 'dcarson'
- #p = 'yoursecretpassword'
- u = input('Username: ')
- p = input('Password: ')
- data = {
- 'username': u,
- 'password': p
- }
- login = 'https://applications.filebound.com/v3/login/?fbsite={}'.format(siteurl)
- try:
- r = requests.post(login, data)
- guid = r.json()
- return guid
- except requests.exceptions.Timeout:
- print('Connection timed out. Please try again.')
- except requests.exceptions.TooManyRedirects:
- print('Too many redirects. Check your URL and try again.')
- except requests.exceptions.RequestException as e:
- print('Catastrophic error. Bailing.')
- print(e)
- sys.exit(1)
- guid = login()
- print(siteurl)
- sitenums = ['018', '019', '020']
- for i in range(len(sitenums)):
- qstring = 'https://applications.filebound.com/v3/query/projectId_1/F4_{}/all?fbsite=https://{}&guid={}'.format(i, siteurl, guid)
- print(qstring)
- r = requests.get(qstring)
- if r.status_code == 200:
- with open('output.txt', 'w') as text_file:
- json_object = r.json()
- for file in json_object[0]['files']['Collection']:
- print('fug')
- #rint(json_object[0]['files']['Collection'][i]['documentCount'], file=text_file)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement