basic python syntax that i don't quite get
Question: I keep getting this error, I'm not sure why though.

    
    
    Traceback (most recent call last):
      File "/home/cambria/Main.py", line 1, in <module>
        from RiotAPI import RiotAPI
      File "/home/cambria/RiotAPI.py", line 6
        def __init__(self, api_key, region=Consts.REGIONS['north_america'])
                                                                          ^
    SyntaxError: invalid syntax
    

I have not used Python for that long, I am just using it because it
facilitates what I'm trying to do well, but I have used various other
languages and as far as I can tell you would want to close these `()'s` in
this statement `def __init__(self, api_key,
region=Consts.REGIONS['north_america'])` however I keep getting a
`SyntaxError: invalid syntax`?

the rest of that definition is as follows, if it helps.

    
    
    class RiotAPI(object):
        def __init__(self, api_key, region=Consts.REGIONS['north_america'])
            self.api_key = api_key
            self.region = region
    

EDIT 1: if i add a `:` at the end of `def __init__(self, api_key,
region=Consts.REGIONS['north_america']):` like so, why? and after doing this i
get a new syntax error that i will address after some wisedom

EDIT 2: new syntax error after fixing the first is,

    
    
    Traceback (most recent call last):
      File "/home/cambria/Main.py", line 1, in <module>
        from RiotAPI import RiotAPI
      File "/home/cambria/RiotAPI.py", line 11
        args = ('api_key': self.api_key)
                         ^
    SyntaxError: invalid syntax
    

which is

    
    
    def _request(self, api_url, params=()):
        args = ('api_key': self.api_key)
        for key, value in params.items():
            if key not in args:
                args[key] = value
    

EDIT 3: This should be the last of it.. no more syntax, just a

    
    
    Traceback (most recent call last):
      File "/home/cambria/Main.py", line 10, in <module>
        main()
      File "/home/cambria/Main.py", line 5, in main
        respons3 = api.get_summoner_by_name('hi im gosan')
      File "/home/cambria/RiotAPI.py", line 31, in get_summoner_by_name
        return self._request(api_url)
      File "/home/cambria/RiotAPI.py", line 12, in _request
        for key, value in params.items():
    AttributeError: 'tuple' object has no attribute 'items'
    

in

    
    
    def _request(self, api_url, params=()):
            args = {'api_key': self.api_key}
            for key, value in params.items():
                if key not in args:
                    args[key] = value
            response = requests.get(
                Consts.URL['base'].format(
                    proxy=self.region,
                    region=self.region,
                    url=api_url
                    ),
                params=args
                )
            print response.url
            return response.json()
    

this is the only error i have received that i really don't know much on. Is
this a result of there being no `.items` on my params? or i left it
initialized as an empty dictionary?


Answer: The problem is just that you're missing a : at the end of the line.

    
    
    def __init__(self, api_key, region=Consts.REGIONS['north_america']):
        self.api_key = api_key
        self.region = region
    

