-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InvalidSchema("No connection adapters were found for '%s'" % url) #4764
Comments
It'd be really helpful to see the value of "page_url". Also are redirects occurring after visiting that url? |
Hi @Blah237, this is almost certainly a parsing issue in how you’re reading the url. If the scheme for the url isn’t http or https, you’ll need to provide a custom adapter. If it is one of the two we support, I’d ensure you aren’t leaving extra white space on the url or accidentally removing a leading character. Since there isn’t evidence of a bug here, I’m going to close this out. If you find anything conclusive, please feel free to reopen. Thanks! |
Apologies @Blah237, rereading the exception, whatever you’re passing as the url is an object which either hasn’t implemented |
@nateprewitt No worries, thank you for the fast response and the help! When I print out the type directly before, I get I admit I am completely lost--the type appears to be correct, and I know the URL is valid because the code works when I copy and paste the URL as a string into it. |
Looks like you're printing the print(str) # <class 'str'>
print(str('abc')) # abc |
@SethMichaelLarson Apologies, I misspoke. My code is as follows:
Which prints |
Well |
@Blah237 so the fact it’s getting to this exception shows that it’s at least string like because we call .lower() and .startswith() on it prior to raising this exception. One thing I realized we haven’t gotten from you yet is the version of Requests you’re using. Can you please supply the info that was requested when the ticket was opened? I’m still not sure if there’s a bug here but it doesn’t make sense looking at the code how we’d get here if this isn’t a valid string. Other exceptions should have triggered before we got here. If you are able to provide the url privately, my email is listed in the project, or I have a keybase account (https://keybase.io/nateprewitt). If you aren’t able to do that, have you tried to reproduce this with a public url? That would be my next step for debugging to determine if it’s the service (possibly redirects) or the file parsing code. |
Apologies for the late reply--I unfortunately can't share the url, but the result remains the same no matter the url used (something like https://google.com doesn't even work). No redirects are taking place. After playing around with it for a bit (and updating all my code for Python 3), the error is now this:
I'm using version 2.19.1. |
Solved it! Reading from a csv file includes a character which appears at the beginning of files, |
That is not an image url. This is the whole image encoded as base64. to decode it you can use import base64 and decode the data. (everything after data:image/jpeg;base64,) im not sure if there is a feature native to 'requests' that handles this. |
i have this issue too. below is the code. ASSETS_DIR = r"C:\Users\Sortol\Documents\adesoji-fastapi\assets" classes = json.load(open(os.path.join(ASSETS_DIR,'categories.json'))) URL = "/v1/models/flower-classification:predict" def read_img_file(file) -> Image.Image: def load_img(img_path, show:bool=False): img_path = random.choice(glob.glob(f"{DATASET_DIR}/test/{cls}/*.jpg"))img = PIL.Image.open(img_path) def predict(img): now i get this error below C:\Users\Sortol\Documents\adesoji-fastapi\app>uvicorn main:app [[0.6627451 0.69411765 0.51372549] [[0.61960784 0.64313725 0.50196078] ... [[0.32941176 0.48627451 0.33333333] [[0.36078431 0.48235294 0.3372549 ] [[0.34509804 0.4745098 0.32941176] |
Getting the above error when I do:
Where page_url is the URL of the webpage I'm requesting. I've confirmed the URL is correct and stored in page_url properly; the issue appears to be the fact that I'm grabbing the URL from a file. Replacing page_url with the actual URL removes the error. Is there some issue with using a URL that's stored in a variable rather than hardcoding it or something?
The text was updated successfully, but these errors were encountered: