<jupyter_start><jupyter_text>APIClient<jupyter_code>import path_config
from cartola.api import ApiClient
from cartola.cartola_settings import dynamic_api, fixed_api<jupyter_output><empty_output><jupyter_text>Endpoints do Cartola sem a necessidade de autenticação.<jupyter_code>print("Dados atualizados a cada rodada.")
_=[print(endpoint) for endpoint in dynamic_api.values()]

print("\nDados fixos.")

_=[print(endpoint) for endpoint in fixed_api.values()]<jupyter_output>Dados atualizados a cada rodada.
https://api.cartolafc.globo.com/mercado/status
https://api.cartolafc.globo.com/atletas/mercado
https://api.cartolafc.globo.com/mercado/destaques
https://api.cartolafc.globo.com/atletas/pontuados
https://api.cartolafc.globo.com/pos-rodada/destaques
https://api.cartolafc.globo.com/partidas

Dados fixos.
https://api.cartolafc.globo.com/clubes
https://api.cartolafc.globo.com/patrocinadores
https://api.cartolafc.globo.com/rodadas<jupyter_text>Iniciando...<jupyter_code>url=dynamic_api['status']
print('Endpoint da Api:')
print(url)
status = ApiClient(url=url)
status<jupyter_output>Endpoint da Api:
https://api.cartolafc.globo.com/mercado/status<jupyter_text>Obter dados no formato Json.<jupyter_code>status.get_json()<jupyter_output><empty_output><jupyter_text>Pegar dados pela chave.<jupyter_code>rodada_atual = status.get_data_by_key(key='rodada_atual')
print(f'Rodada Atual: {rodada_atual}\n')
status_mercado = status.get_data_by_key(key='status_mercado')
print(f'Rodada Atual: {status_mercado}\n')<jupyter_output><empty_output><jupyter_text>Salvar arquivo Json.<jupyter_code>dir_path = fr'json_files/rodada{rodada_atual}'
status.save_as_json(dir_path=dir_path, round=rodada_atual)
print(f"\nDados salvos em: {dir_path}")<jupyter_output>Dados salvos em: json_files/rodada26
{'fraction_non_alphanumeric': 0.13026389668725435, 'fraction_numerical': 0.0011229646266142617, 'mean_word_length': 8.580645161290322, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '321377', 'license': 'MIT', 'n_tokens_mistral': 713, 'n_tokens_neox': 718, 'n_words': 87, 'path': 'notebooks/.ipynb_checkpoints/api_client-checkpoint.ipynb', 'repo_name': 'DanielSalesS/cartola_data', 'size': '1781'}