title: Invalid syntax error in python program which tries to figure out an IP
body: <p>I have no experience whatsoever in coding but wanted to get this code snippet here working:</p>
  <pre><code>
  import re
  import sys
  import json
  import GeoIP
  import urllib
  import string
  import requests
  
  gi = GeoIP.open(&quot;GeoLiteCity.dat&quot;,GeoIP.GEOIP STANDARD)
  r = requests.get('http://lichess.org/stream', stream=True)
  
  buff = ''
  pattern = re.compile(sys.argv[1] + '.{30}')
  for content in r.iter content():
      if content:
          buff = buff + content
          if len(buff) &gt; 1000:
              result keys = re.findall(pattern, buff)
              for el in result keys:
                  result = string.split(el)
                  print result[0], result[1], result[2][:-8], gi.record by addr(result[2][:-8])['country name'],
                  gi.record by addr(result[2][:-8])['region name'], gi.record by addr(result[2][:-8])['city'] 
              buff = buff[-30:]
  
  
  </code></pre>
  <p>the compiler tells me there is invalid syntax in line 9, where it says STANDARD.</p>
  <p>I looked the code up to find out the IP adress of a user based on the ID of a game on a chess site called lichess.org. I sort of expect some changes will be necessary given the fact that this code was posted 7 years ago and lichess changed certain things.</p>
  <p>The OP of the thread where I found this additionally gave this advice:</p>
  <blockquote>
  <p>usage: getip.py owlc08je</p>
  </blockquote>
  <blockquote>
  <p>where getip.py your script name, &quot;owlc08je&quot; -id of game. If someone making move in this game his ip, country and city print out to the console.</p>
  </blockquote>
  <p>However, it does not work.</p>
  <p>Thanks in advance</p>
  <p>Edited code with underscores and changes:</p>
  <pre><code>
  
  import re
  import sys
  import json
  import GeoIP
  import urllib
  import string
  import requests
  
  gi = GeoIP.open(&quot;GeoLiteCity.dat&quot;,GeoIP.GEOIP_STANDARD)
  r = requests.get('http://lichess.org/stream', stream=True)
  
  buff = ''
  pattern = re.compile(sys.argv[1] + '.{30}')
  for content in r.iter_content():
      if content:
          buff = buff + content
          if len(buff) &gt; 1000:
              result_keys = re.findall(pattern, buff)
              for el in result_keys:
                  result = string.split(el)
                  print(result[0], result[1], result[2][:-8], gi.record_by_addr(result[2][:-8])['country name'],
      gi.record by addr(result[2][:-8])['region name'], gi.record by addr(result[2][:-8])['city'])
              buff = buff[-30:]
  </code></pre>