This is only giving me one line back, I want all lines back. Is there a way to have iter_lines show all lines? Thanks.
Python:
#import modules
import requests
import json
import re
#retrieve lichess games for a specific user
def get_lichess_games(username):
api_session = requests.Session()
api_headers = {
'Authorization' : 'Bearer CZfakeeeeBWo',
'Accept' : 'application/x-ndjson',
}
with api_session.get(f'https://lichess.org/api/games/user/{username}', headers=api_headers, stream=True) as response:
for line in response.iter_lines():
if line:
test = json.loads(line.decode('utf-8'))
return test
data = get_lichess_games(username='putin')
print(data)