Category : python-requests

I have the following async code logic in my python code using ThreadPool to call many microservices endpoints using requests. def get_data_url1(): my_url = MY_URL_1 headers = { ‘api-key’: MY_API_KEY } response = requests.request(‘GET’, url=my_url, headers=headers) return response def get_data_url2(): my_url = MY_URL_2 response = requests.request(‘GET’, url=my_url) return response def get_data_url3(): my_url = MY_URL_3 data ..

Read more

I’m tying to remove content-length from headers as its getting added by default and my request is failing so I followed this answer Python requests remove the Content-Length header from POST s = Session() req = Request(‘POST’, url=website_url, data=payload, headers=headers) prepped = req.prepare() # do something with prepped.headers del prepped.headers[‘content-length’] and after printing I can ..

Read more

I’m trying to login to a website with a python script using the requests library, but I keep getting a 405 error and I’m lost on why I’m getting it. import requests payload = { ‘guid’: ‘xxxxx’, ‘password’: "xxxx" } head = {‘Host’: ‘www.blockchain.com’, ‘Connection’: ‘keep-alive’, ‘User-Agent’: ‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, ..

Read more

When i try to do "pip install pyinstaller" I get this error (Python 39) ERROR: Command errored out with exit status 1: command: ‘c:python39python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’C:UserskaitoAppDataLocalTemppip-install-x1uajlp_pefilesetup.py’"’"’; __file__=’"’"’C:UserskaitoAppDataLocalTemppip-install-x1uajlp_pefilesetup.py’"’"’;f=getattr(tokenize, ‘"’"’open’"’"’, open)(__file__);code=f.read().replace(‘"’"’rn’"’"’, ‘"’"’n’"’"’);f.close();exec(compile(code, __file__, ‘"’"’exec’"’"’))’ install –record ‘C:UserskaitoAppDataLocalTemppip-record-i794i3gcinstall-record.txt’ –single-version-externally-managed –compile –install-headers ‘c:python39Includepefile’ cwd: C:UserskaitoAppDataLocalTemppip-install-x1uajlp_pefile Complete output (14 lines): running install running ..

Read more

Here is the website: https://www.nbim.no/en/the-fund/market-value Essentially I need to scrape the number under the header (Current market value). Right now it is: 10 917. The problem is that is only for today. I need to get that daily data number from the beginning of 2020. Is it possible? Where might I find where that daily ..

Read more