Open startakovsky opened 4 months ago
Same here, feels like a regression in the REST API.
Yeah, I just used it on my work computer and it bunked too, and for that I'm on python 3.11. Same error. Thanks @alexander-roemer for the validation.
I've got a ticket open with GH support, will report back if I find out anything useful.
Just discovered this project, and thought it was an error on my part. Hope GH maintainers get in touch soon
I'm experiencing the same here. I tried modifying the headers in renderers.py
based on
https://stackoverflow.com/questions/55375001/how-to-fix-415-unsupported-media-type-error-in-python-using-requests
else:
url = '{0}/markdown/raw'.format(self.api_url)
data = text.encode('utf-8')
headers = {'content-type': 'text/x-markdown; charset=UTF-8'}
headers = {'content-type': '*/*', 'accept': '*/*'}
but get the same error. Unfortunately, I'm not familiar enough with the api interactions to be more useful than that.
I have kind of a hacky workaround using directly the github api with gh
:
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/markdown \
-f text="$(cat README.md)" > readme.html
Then open readme.html locally.
:warning:
gh
must be logged to your github account.
Same for me. Gentoo with python in virtual env. Python: 3.11.7 Kernel: 6.1.67
requests.exceptions.HTTPError: 415 Client Error: Unsupported Media Type for url: https://api.github.com/markdown/raw
The error page body is:
{"message":"Invalid request media type (expecting 'text/plain')","documentation_url":"https://docs.github.com/rest/markdown/markdown#render-a-markdown-document-in-raw-mode"}
But setting Content-Type to text/plain
doesn't fix it.
Smells like a problem on the GitHub side.
In the mean time, --user-content
still works, but IIRC it's slightly different rendering.
Same here!
If the --user
option is used then it seems to work.
Same error here. I've changed the code in here to the below and it'working fine:
# if self.user_content:
url = '{0}/markdown'.format(self.api_url)
data = {'text': text, 'mode': 'gfm'}
if self.context:
data['context'] = self.context
data = json.dumps(data, ensure_ascii=False).encode('utf-8')
headers = {'content-type': 'application/json; charset=UTF-8'}
# else:
# url = '{0}/markdown/raw'.format(self.api_url)
# data = text.encode('utf-8')
# headers = {'content-type': 'text/x-markdown; charset=UTF-8'}
Update from GitHub support: they confirmed this issue exists and I am waiting on an update from engineering.
If the
--user
option is used then it seems to work.
This is a valid workaround. Works also for me when using the empty personal token via --pass
option as described in the README: https://github.com/joeyespo/grip?tab=readme-ov-file#access . HTH for the time being.
Just ran into this, thank you for the feedback and support, all! I can confirm that
grip --user=<username> --pass=''
indeed is a workaround at the moment.
Let's one-up that, for my mac (with z-shell), I ran this and now I just type grip
and hit the <return>
key twice
echo "export GRIPUSER='asdfasdf'" >> ~/.zshrc && echo "export GRIPPASS=''" >> ~/.zshrc && echo "alias grip=\"grip --user=\$GRIPUSER --pass=\$GRIPPASS\"" >> ~/.zshrc && source ~/.zshrc
Or, more easily, you could set username and password in ~/.grip/settings.py
.
Just ran into this, thank you for the feedback and support, all! I can confirm that
grip --user=<username> --pass=''
indeed is a workaround at the moment.
As is
grip --pass=$(cat /path/to/github_token)
where my github personal token is stored in /path/to/github_token
Hi folks, GitHub employee here. Just wanted to report that the API issue is now resolved, and unauthenticated requests to the markdown/raw
endpoint are working again. A change was pushed to a caching layer last week that inadvertently resulted in issues with the incoming Content-Type
header, but that bug has been fixed.
Thanks for bringing this to our attention, and apologies for the trouble!
Getting an error and I don't know why. I thought it was because I had a circular link (like a link from A --> B and from B --> A) but then I removed it and it still didn't work. Details below