Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

HTTP Error 500: Internal Server Error when calling get_audit_log with "after" variable

Open
#101 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
github, python
Domain
api

Research direction

Start in /opt/conda/lib/python3.9/site-packages/ghapi/core.py and compare how get_audit_log builds the request with and without the after argument. Check the GitHub audit-log API documentation and reproduce the supplied call using the documented date and timestamp forms; done means the supported format is handled correctly or the invalid value produces a clear error, with the expected format documented.

Written by the indexing model from the issue text.

Description

api.orgs.get_audit_log(ORG, per_page=10, page=2, after="2021-09-27T15:05:06+01:00")
// Here I'm using time format as per GHAPI rest docs. ghapi python docs suggest 2021-09-27 should work. Tried
// this and also timestamps, but all gave internal error.

If i remove the "after" variable, the call works fine.

I believe the problem is that the "after" variable is in [Link header format](api.orgs.get_audit_log(ORG, per_page=10, page=2, after="2021-09-27T15:05:06+01:00")) and perhaps this doesn't get autogenerated correctly.

Link: https://api.github.com/orgs/ORG/audit-log?after=MTYwMTkxOTU5NjQxM3xZbGI4VE5EZ1dvZTlla09uWjhoZFpR&before=; rel="next",

The value between after= and & does not completely URL + base64 decode to an obvious time format.

Signature:  
api.orgs.get_audit_log(
    org,
    phrase=None,
    include=None,
    after=None,
    before=None,
    order=None,
    per_page=None,
    page=None,
)
Type:        _GhVerb
String form:
orgs.get_audit_log(org, phrase=None, include=None, after=None, before=None, order=None, per_page=None, page=None)
https://docs.github.com/rest/reference/orgs#get-audit-log
File:        /opt/conda/lib/python3.9/site-packages/ghapi/core.py

I would expect any values in the signature to specify the time format required, possibly add an example to the docs, and the error should be something less severe than a 500 internal error.

Dominant language
Python
Stars
687
Forks
69
Avg merge
1m
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AnswerDotAI/ghapi

All issues in AnswerDotAI/ghapi

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.