title: How can I extract contents from a file stored in gitlab repos
body: <p>Using the gitlab-python package, I'd like to extract lines from all Dockerfiles. Using my code below, I am able to get project names and url to the repo I want but how can I ensure there is a Dockerfile and read the contents of the Dockerfile. </p>
  
  <pre><code>import gitlab
  import json
  from pprint import pprint
  import requests
  import urllib.request
  
  
  # private token authentication
  gl = gitlab.Gitlab('&lt;path_to_gitlab_repo&gt;', private_token=&lt;token_here&gt;)
  
  gl.auth()
  
  # list all projects
  projects = gl.projects.list()
  for project in projects:
      # print(project) # prints all the meta data for the project
      print("Project: ", project.name)
      print("Gitlab URL: ", project.http_url_to_repo)
      # print("Branches: ", project.repo_branches)
      pprint(project.repository_tree(all=True))
      f = urllib.request.urlopen(project.http_url_to_repo)
      myfile = f.read()
      print(myfile)
      print("\n\n")
  </code></pre>
  
  <p>The output I get now is : </p>
  
  <pre><code>Gitlab URL:  &lt;path_to_gitlab_repo&gt;
  [{'id': '0c4a64925f5c129d33557',
    'mode': '1044',
    'name': 'README.md',
    'path': 'README.md',
    'type': 'blob'}]
  </code></pre>