M
M
Marko332022-02-01 12:38:42
Python
Marko33, 2022-02-01 12:38:42

I can't parse all values, why?

import requests
from fake_useragent import UserAgent
import json
ua = UserAgent()


def collect_data():
    resource = requests.get(

        url='https://market.csgo.com/api/v2/prices/RUB.json',
        headers={'user-agent': f'{ua.random}'}
    )

    with open('tm.json','w') as file:
        json.dump(resource.json(), file, indent=4, ensure_ascii=False)

def main():
    collect_data()

if __name__ == '__main__':
    main()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Nesterov, 2022-02-01
@Marko33

The error is easy to google:
with open('tm.json','w',encoding='utf-8') as file:

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question