Closed falahfakhri-Iraq closed 2 years ago
Hi Falah,
Thanks for raising the issue. It looks like the problem isn't necessarily with the package but that the medium api is returning the 413 response:
"request entity too large"
which seems like a common api issue when you try to upload a large file. Can you:
curl
it and try to replicate the issueOnce I have the notebook I can set up a fresh environment and test to see if I can replicate the error. If so, I will look into finding a way to reduce the file size so that the Medium API will accept your publication. At first glance I'm not sure how to do this as all images/tables are already only passed by reference (they are uploaded separately to Medium).
Dear @mjam03 Thanks a lot for your reply, following is the link tot the notebook within my Github,
As a solution comes to my mind now, I think for the big size it's possible to create an image for the whole notebook, and post to Medium, but I also haven't a clue of how to do so.
Okay great. I've just replicated and got a timeout error back from the Medium API. This is because of the notebook's size even after stripping out all the images and tables and passing them by ref.
On inspection it seems like the notebook itself is not actually an 'article' but has lots of print statements outputting lists of variable names. I don't understand why that is making the markdown version so large but nevertheless this isn't really the intention of the package. The aim is to streamline publication of articles written in jupyter notebooks to Medium, not taking any given notebook (not written as an article) and find a way to put it into Medium.
Will close the issue but:
Returned error message below
"ValueError: Problem with posting: ])}while(1);{\"success\":false,\"error\":\"request entity too large\",\"v\":3,\"b\":\"20211123-1931-root\"}
Traceback (most recent call last): File \"C:\Users\FALAH FAKHRI\AppData\Local\Programs\Python\Python39\lib\site-packages\jupyter_to_medium\_publish_to_medium.py\", line 295, in publish_to_medium self.result = req.json() File \"C:\Users\FALAH FAKHRI\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py\", line 910, in json return complexjson.loads(self.text, **kwargs) File \"C:\Users\FALAH FAKHRI\AppData\Local\Programs\Python\Python39\lib\json\init.py\", line 346, in loads return _default_decoder.decode(s) File \"C:\Users\FALAH FAKHRI\AppData\Local\Programs\Python\Python39\lib\json\decoder.py\", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File \"C:\Users\FALAH FAKHRI\AppData\Local\Programs\Python\Python39\lib\json\decoder.py\", line 355, 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 \"C:\Users\FALAH FAKHRI\AppData\Local\Programs\Python\Python39\lib\site-packages\jupyter_to_medium\_bundler.py\", line 61, in upload data = publish(**kwargs) File \"C:\Users\FALAH FAKHRI\AppData\Local\Programs\Python\Python39\lib\site-packages\jupyter_to_medium\_publish_to_medium.py\", line 449, in publish p.main() File \"C:\Users\FALAH FAKHRI\AppData\Local\Programs\Python\Python39\lib\site-packages\jupyter_to_medium\_publish_to_medium.py\", line 331, in main self.publish_to_medium() File \"C:\Users\FALAH FAKHRI\AppData\Local\Programs\Python\Python39\lib\site-packages\jupyter_to_medium\_publish_to_medium.py\", line 297, in publish_to_medium raise ValueError(\"Problem with posting:\n\" + req.text) ValueError: Problem with posting: ])}while(1);{\"success\":false,\"error\":\"request entity too large\",\"v\":3,\"b\":\"20211123-1931-root\"} "