Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- def check_last_file(text):
- if text[:2] = 'We':
- return True
- else:
- return False
- def get_url_from_file(file):
- with open(file) as f:
- name = f.readline().strip('\n')
- return name
- def go_through_chain(url):
- print('I\'m going go to url: %s' % url)
- query = request.get(url)
- content = query.text
- if not check_last_file(content):
- go_through_chain(content)
- else:
- print('URL %s - is FINAL!!!' % content)
- if __name__ == '__main__':
- address = 'https://stepic.org/media/attachments/course67/3.6.3/'
- first_step_file = str(input('Enter first file name: '))
- url = address + get_url_from_file(first_step_file)
- go_through_chain(url)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement