Comments (4)
Ok, checked the code further and when using the shopcart URL used to get the data for this dialog, I see no immidiate issue, the 96x96 replacement to 900x900 should still be valid.
With this, using imageList, we actually could make the parts page even cooler by making it possible to flip through all big images, but that is more a feature request.
The Image format is jpg. Is that what we expect?
Seems pretty standard, a bit confused why this would fail now.
from kicad-jlcpcb-tools.
Ok, that is wild.
I enforced interpreting the byte stream as a JPEG instead of auto detection:
def get_scaled_bitmap(self, url, width, height):
"""Download a picture from a URL and convert it into a wx Bitmap"""
content = requests.get(url, timeout=10).content
self.logger.info("Fetching Image %s", str(url))
io_bytes = io.BytesIO(content)
self.logger.info("Image Byte Content %s", str(io_bytes))
image = wx.Image(io_bytes, type=wx.BITMAP_TYPE_JPEG)
image = image.Scale(width, height, wx.IMAGE_QUALITY_HIGH)
result = wx.Bitmap(image)
return result
and then I get this:
But the URL is 100% positivly pointing to a jpg:
https://assets.lcsc.com/images/lcsc/900x900/20221227_FH--Guangdong-Fenghua-Advanced-Tech-0805B152K500NT_C1717_front.jpg
I'm a bit baffled. Any ideas?
EDIT: The header of the downloaded file definetly also advertises it as jpeg and no ther image viewer is complaining. I'm more thinking this is an issue with the Byte-IO-Stream.
from kicad-jlcpcb-tools.
ok haha: I think we have our issue:
2024.03.05 14:45:49 - INFO - get_scaled_bitmap - Fetching Image https://assets.lcsc.com/images/lcsc/900x900/20221227_FH--Guangdong-Fenghua-Advanced-Tech-0805B152K500NT_C1717_front.jpg
2024.03.05 14:45:49 - INFO - get_scaled_bitmap - Image Byte Content b'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">\n<TITLE>ERROR: The request could not be satisfied</TITLE>\n</HEAD><BODY>\n<H1>403 ERROR</H1>\n<H2>The request could not be satisfied.</H2>\n<HR noshade size="1px">\nRequest blocked.\nWe can\'t connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.\n<BR clear="all">\nIf you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.\n<BR clear="all">\n<HR noshade size="1px">\n<PRE>\nGenerated by cloudfront (CloudFront)\nRequest ID: Up1AOdk5pjWucz0rRMwp0pflI493h8hbj6tWAevIERNzZJNcp5j95g==\n</PRE>\n<ADDRESS>\n</ADDRESS>\n</BODY></HTML>'
from kicad-jlcpcb-tools.
Ok, so they are filtering for Python User Agent.
Then let's pretend we are a browser:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36"
}
content = requests.get(url, headers=headers, timeout=10).content
I will submit a PR to fix this
from kicad-jlcpcb-tools.
Related Issues (20)
- Operations are slower with fts5 database HOT 9
- Plugin sometimes stops working after combining part files. HOT 1
- Crash in parts download due to "NSRangeException" HOT 2
- Rotations empty on KiCAD 8.0 HOT 2
- All mappings are suddenly lost HOT 6
- Additional Maintainers HOT 7
- Hard to type in category field after searching
- Unable to download database, CERTIFICATE_VERIFY_FAILED
- Solved by upgrading sqllite3 2024.04.03: sqlite3.OperationalError: no such tokenizer: trigram HOT 1
- Right side button column cuts off text descriptions
- ClassDefFoundError
- Automatic footprint and category population
- Slow selection of Components in list in main window
- 2024.04.03 Sorting on number in stock is LSCS assignment window not working
- 2024.04.04 5kΩ find also 15kΩ and much more HOT 1
- keywords such as 5k 1% doesn't work
- [2024.04.03] rotation problem on SOT-23-6 HOT 3
- i do not see any components in the JLCPCB tools list HOT 1
- Assign LCSC number function not working KICAD 8.0.2 HOT 14
- Exception on python action plugin code HOT 18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kicad-jlcpcb-tools.