from collections import OrderedDict

import requests
import cssutils

USER_AGENTS = OrderedDict()
USER_AGENTS['woff'] = 'Mozilla/5.0 AppleWebKit/537.36 Chrome/30', # Chrome
USER_AGENTS['ttf'] = 'Mozilla/5.0 (Linux; U; Android 2.1-update1;)', #Andord 2
USER_AGENTS['eot'] = 'Mozilla/4.0 (compatible; MSIE 6.0;)', # IE6
USER_AGENTS['woff'] = 'Mozilla/4.0 (iPad; CPU OS 4_0_1 ) AppleWebKit', #iOS<4.2


def main():
    font_url = 'http://fonts.googleapis.com/css?family=Open+Sans:300,400,700,800|Dosis:300,400'
    sheets={}
    for (format, ua) in USER_AGENTS.items():
        headers = {
            'User-Agent': ua,
        }

        r =requests.get(font_url, headers=headers)
        sheets[format] = cssutils.parseString(r.content)


if __name__ == '__main__':
    main()
import requests
import cssutils

USER_AGENTS = {
    'woff': 'Mozilla/5.0 AppleWebKit/537.36 Chrome/30', # Chrome
    'eot': 'Mozilla/4.0 (compatible; MSIE 6.0;)', # IE6
    'ttf': 'Mozilla/5.0 (Linux; U; Android 2.1-update1;)', #Andord 2
    'svg': 'Mozilla/4.0 (iPad; CPU OS 4_0_1 ) AppleWebKit', #iOS<4.2
}

def main():
    font_url = 'http://fonts.googleapis.com/css?family=Open+Sans:300,400,700,800|Dosis:300,400'
    sheets={}
    for (format, ua) in USER_AGENTS.items():
        headers = {
            'User-Agent': ua,
        }

        r =requests.get(font_url, headers=headers)
        sheets[format] = cssutils.parseString(r.content)


if __name__ == '__main__':
    main()
Revert "The order of the formats matters. Use OrderedDict instead of dict"
Revert "The order of the formats matters. Use OrderedDict instead of dict"

I can't rely on the order of dict. The control flow is more complex.

This reverts commit 3389ed71971ddacd185bbbf8fe667a8651108c70.

- from collections import OrderedDict
- 
  import requests
  import cssutils
  
- USER_AGENTS = OrderedDict()
+ USER_AGENTS = {
- USER_AGENTS['woff'] = 'Mozilla/5.0 AppleWebKit/537.36 Chrome/30', # Chrome
+     'woff': 'Mozilla/5.0 AppleWebKit/537.36 Chrome/30', # Chrome
+     'eot': 'Mozilla/4.0 (compatible; MSIE 6.0;)', # IE6
- USER_AGENTS['ttf'] = 'Mozilla/5.0 (Linux; U; Android 2.1-update1;)', #Andord 2
+     'ttf': 'Mozilla/5.0 (Linux; U; Android 2.1-update1;)', #Andord 2
- USER_AGENTS['eot'] = 'Mozilla/4.0 (compatible; MSIE 6.0;)', # IE6
- USER_AGENTS['woff'] = 'Mozilla/4.0 (iPad; CPU OS 4_0_1 ) AppleWebKit', #iOS<4.2
+     'svg': 'Mozilla/4.0 (iPad; CPU OS 4_0_1 ) AppleWebKit', #iOS<4.2
- 
+ }
  
  def main():
      font_url = 'http://fonts.googleapis.com/css?family=Open+Sans:300,400,700,800|Dosis:300,400'
      sheets={}
      for (format, ua) in USER_AGENTS.items():
          headers = {
              'User-Agent': ua,
          }
  
          r =requests.get(font_url, headers=headers)
          sheets[format] = cssutils.parseString(r.content)
  
  
  if __name__ == '__main__':
      main()
Revert "The order of the formats matters. Use OrderedDict instead of dict"
## Code Before:
from collections import OrderedDict

import requests
import cssutils

USER_AGENTS = OrderedDict()
USER_AGENTS['woff'] = 'Mozilla/5.0 AppleWebKit/537.36 Chrome/30', # Chrome
USER_AGENTS['ttf'] = 'Mozilla/5.0 (Linux; U; Android 2.1-update1;)', #Andord 2
USER_AGENTS['eot'] = 'Mozilla/4.0 (compatible; MSIE 6.0;)', # IE6
USER_AGENTS['woff'] = 'Mozilla/4.0 (iPad; CPU OS 4_0_1 ) AppleWebKit', #iOS<4.2


def main():
    font_url = 'http://fonts.googleapis.com/css?family=Open+Sans:300,400,700,800|Dosis:300,400'
    sheets={}
    for (format, ua) in USER_AGENTS.items():
        headers = {
            'User-Agent': ua,
        }

        r =requests.get(font_url, headers=headers)
        sheets[format] = cssutils.parseString(r.content)


if __name__ == '__main__':
    main()
## Instruction:
Revert "The order of the formats matters. Use OrderedDict instead of dict"
## Code After:
import requests
import cssutils

USER_AGENTS = {
    'woff': 'Mozilla/5.0 AppleWebKit/537.36 Chrome/30', # Chrome
    'eot': 'Mozilla/4.0 (compatible; MSIE 6.0;)', # IE6
    'ttf': 'Mozilla/5.0 (Linux; U; Android 2.1-update1;)', #Andord 2
    'svg': 'Mozilla/4.0 (iPad; CPU OS 4_0_1 ) AppleWebKit', #iOS<4.2
}

def main():
    font_url = 'http://fonts.googleapis.com/css?family=Open+Sans:300,400,700,800|Dosis:300,400'
    sheets={}
    for (format, ua) in USER_AGENTS.items():
        headers = {
            'User-Agent': ua,
        }

        r =requests.get(font_url, headers=headers)
        sheets[format] = cssutils.parseString(r.content)


if __name__ == '__main__':
    main()