Блог пользователя 2020TAndr

Автор 2020TAndr, история, 3 года назад, По-английски

Haven't found any way to access standings of contest which belongs to a group, even when anybody can see them (e.g. https://mirror.codeforces.com/group/a7fj9QBnKu/contest/333884/standings).

UPD1: I tried to find the contest in 'contest.list', but it doesn't show there, even with my API key. As well, I tried to add parameter 'group'/'groupId' in link, but that doesn't work too.

Теги api
  • Проголосовать: нравится
  • +20
  • Проголосовать: не нравится

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

'groupCode' worked for me.

I found it here

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится -10 Проголосовать: не нравится

    didn't work for me

    can you show an example ?

    • »
      »
      »
      2 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      This is using the example from codeforces api page:

      If your key is xxx, secret is yyy, chosen rand is 123456 and you want to access method contest.hacks for contest 566 in a group with groupCode 789, you should compose request like this: https://mirror.codeforces.com/api/contest.hacks?groupCode=789&contestId=566&apiKey=xxx&time=1657307946&apiSig=123456<hash>, where <hash> is sha512Hex(123456/contest.hacks?apiKey=xxx&contestId=566&groupCode=789&time=1657307946#yyy)


      Here is my python sample

              import requests, hashlib
              rand = random.randint(0, 100000)
              rand = str(rand).zfill(6)
              current_time = str(int(time.time()))
              api_sig = rand + '/contest.status?apiKey=' + api_key + '&contestId=' + contest_id + '&groupCode=' + group_code + '&time=' + current_time + '#' + api_secret
              hash = hashlib.sha512(api_sig.encode()).hexdigest()
              data = requests.get(f'https://mirror.codeforces.com/api/contest.status?groupCode={group_code}&contestId={contest_id}&apiKey={api_key}&time={current_time}&apiSig={rand+hash}').json()
          
      
      • »
        »
        »
        »
        2 года назад, # ^ |
        Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

        {'status': 'FAILED', 'comment': 'contestId: Contest with id 387969 not found'}

        Still not working

        in codeforces api page there is no any thing about groupcode

        maybe they removed this future from codeforces ?!

        • »
          »
          »
          »
          »
          2 года назад, # ^ |
            Проголосовать: нравится 0 Проголосовать: не нравится

          Groupcode was not mentioned in the api page, I just meant that I was going to clarify using the same example.

          (This is just a theory I might be wrong) I think you need a certain privilege to be able to do that. I tested only using two groups, I was able to get results from the one where I was a manager, and did not get results in which I was just a participant.

          • »
            »
            »
            »
            »
            »
            2 года назад, # ^ |
              Проголосовать: нравится 0 Проголосовать: не нравится

            Got it, i found out that i have to be manager. Ty for your response