import requests


def get_file_size(url, params, timeout=10):
  """Get file size from a given URL in bytes.

  Args:
    url: str.
      URL string.
    timeout: int, optional.
      Timeout in seconds.

  Returns:
    int. File size in bytes.

  #### Examples

  ```python
  get_file_size(url)
  ## 178904
  ```
  """
  try:
    response = requests.get(url, params={}, stream=True)
  except (requests.exceptions.HTTPError) as e:
    print(e)
    return 0
  try:
    file_size = int(response.headers["Content-Length"])
  except (IndexError, KeyError, TypeError):
    return 0

  return file_size