https

Request headers to scrape pypi.org

Request proxies to access PyPI Question: I am trying to screenscrape PyPI packages using the requests library and beautiful soup – but am met with an indefinite hang. I am able to retrieve html from a number of sites with: session = requests.Session() session.trust_env = False response = session.get("http://google.com") print(response.status_code) i.e. without providing headers. I …

Total answers: 4

Setting favicon in FastAPI over https

Setting favicon in FastAPI over https Question: I have deployed an API on a Ubuntu server and set-up Nginx and SSL so that all requests are made through https. In FastAPI, I have set a favicon route to set the favicon for the site and this works during development, however in production I get the …

Total answers: 1

How do I get Python to send as many concurrent HTTP requests as possible?

How do I get Python to send as many concurrent HTTP requests as possible? Question: I’m trying to send HTTPS requests as quickly as possible. I know this would have to be concurrent requests due to my goal being 150 to 500+ requests a second. I’ve searched everywhere, but get no Python 3.11+ answer or …

Total answers: 3

Socket error (An operation was attempted on something that is not a socket) on aiohttp function

Socket error (An operation was attempted on something that is not a socket) on aiohttp function Question: async def simultaneous_chunked_download(urls_paths, label): timeout = ClientTimeout(total=60000) sem = asyncio.Semaphore(5) async with aiohttp.ClientSession(timeout=timeout, connector=aiohttp.TCPConnector(verify_ssl=False)) as cs: async def _fetch(r, path): async with sem: async with aiofiles.open(path, "wb") as f: async for chunk in r.content.iter_any(): if not chunk: break …

Total answers: 1

Allowing access to hidden folder from web. Plotly-dash

Allowing access to hidden folder from web. Plotly-dash Question: I think my question can be confusing, but I’ll explain it better. What I want is to have my app return files located in hidden directories using http requests, for instance if I make a http://mywebsite.com/assets/style.css request I get the style.css file but, I also want …

Total answers: 2

Issues with installing python libraries on Windows : CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/anaconda/win-64

Issues with installing python libraries on Windows : CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/anaconda/win-64 Question: I’d like to install the pymongo library but I’m getting the following error: (C:UsersxxxxxxxAppDataLocalContinuumanaconda3) C:Usersxxxxxxx> conda install -c anaconda pymongo Fetching package metadata … CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/a naconda/win-64/repodata.json> Elapsed: – An HTTP error …

Total answers: 26

Django redirecting http -> https

Django redirecting http -> https Question: I am running: python manage.py runserver localhost:44100 And this is redirecting me to https: ยป http http://localhost:44100/ HTTP/1.0 301 Moved Permanently Content-Type: text/html; charset=utf-8 Date: Mon, 05 Mar 2018 14:09:09 GMT Location: https://localhost:44100/ Server: WSGIServer/0.1 Python/2.7.14 X-Frame-Options: SAMEORIGIN Why / how is this happening? What setting does control whether …

Total answers: 3

Python requests SSL error – certificate verify failed

Python requests SSL error – certificate verify failed Question: This code import requests requests.get(“https://hcaidcs.phe.org.uk/WebPages/GeneralHomePage.aspx”) is giving me this error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777) I know practically nothing about SSL, but I’ve tried downloading the site’s certificate and pointing to that file using the verify option, but it hasn’t worked. Am I missing something? …

Total answers: 5

ssl.SSLError: tlsv1 alert protocol version

ssl.SSLError: tlsv1 alert protocol version Question: I’m using the REST API for a Cisco CMX device, and trying to write Python code which makes a GET request to the API for information. The code is as follows and is the same as that in the file except with the necessary information changed. from http.client import …

Total answers: 11