8000 Expected status_code 200 but got 304 · Issue #798 · sigmavirus24/github3.py · GitHub
[go: up one dir, main page]

Skip to content
Expected status_code 200 but got 304 #798
Closed
@bboe

Description

@bboe

It would appear that fetching events can occasionally result in an unexpected 304 response status code. Event loop is created as:

itr = self.repo.events(etag=etag)

I recently upgraded from 1.0.0a4 to 1.0.1 and started getting this issue.

Expected status_code 200 but got 304
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/github3/models.py", line 161, in _json
    ret = response.json()
  File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 892, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/farcy", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/farcy/__init__.py", line 400, in main
    Farcy(config).run()
  File "/usr/local/lib/python3.6/site-packages/farcy/__init__.py", line 369, in run
    for event in self.events():
  File "/usr/local/lib/python3.6/site-packages/farcy/__init__.py", line 257, in events
    newest_id = self._event_loop(itr, events)
  File "/usr/local/lib/python3.6/site-packages/farcy/__init__.py", line 132, in _event_loop
    for event in itr:
  File "/usr/local/lib/python3.6/site-packages/github3/structs.py", line 76, in __iter__
    json = self._get_json(response)
  File "/usr/local/lib/python3.6/site-packages/github3/structs.py", line 109, in _get_json
    return self._json(response, 200)
  File "/usr/local/lib/python3.6/site-packages/github3/models.py", line 163, in _json
    raise exceptions.UnexpectedResponse(response)
github3.exceptions.UnexpectedResponse: 304 [No message]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0