I built a rest api using flask restplus and I tested it using the swagger documentation, and it seems to be fully functional and working just fine. I now want to test the API using the python requests library, but I’m getting the following error: I imagine this is because I did not authorize using the credentials. I do have
Tag: python-requests
Connecting to Wifi in micro python hangs
I’m trying to setup a function that interactively gets takes user input and connects to WiFi. I can scan the nearby networks and get a list of SSIDs but once I go to actually connect the program always hangs. I can’t seem to figure out why. hardware: LOLIN D32 (esp32 based board) this is the only code on the board
How to make multiple api calls with python requests
I am trying to make parallel calls to external apis from django using requests or any other library that allows me to do this. I have already tried using grequests to make this calls, sometimes it works but most times I get ‘NoneType’ object has no attribute ‘json’ error on the client side. Here are my codes views.py On the
unittest assertionError in python AssertionError: != 200
I’m writing python tests with unittest and requests modules but getting AssertionError: <Response [200]> != 200 Tests are setup in two functions, test_get and test_post. Test runners starts from Tests class, where the issue is within test2. I’ve tried to assert this also: <Response [200]> also. But getting this Error instead: For this I am using httpbin and pycharm. Answer
Can this beautifulsoup script be simplified with Regex?
I wrote some beautifulsoup scripts, and one part seems really redundant, I am thinking if it can be simplified with Regex. All posts from this forum are marked with different colors, what I did is to search each color with one line. For six colors I did six lines with only one words difference. I am not sure if it
Python Stream Decode Base64 to valid utf8
I’m currently working on a problem, which I just cannot seem to find the proper solution. Maybe you guys can help me, thanks! What I am trying to do Web is returning a JSON (value is encoded in valid BASE64, which was before that ùtf-8) requests.get(url, stream=True streaming from requests (chunks=1020) iter_content(chunk_size=1020, decode_unicode=False) do some chunk work (replacing everything with
Ubuntu 18.04 python 2.7 urllib request not getting data
I have this python script which works with no problem on ubuntu 16.04 But it wont get data in ubuntu 18.04, any idea what the problem could be? No errors. Output: Full code is here : https://github.com/papampi/nvOC_by_fullzero_Community_Release/blob/Dual-cuda/WTM_SWITCHER Answer Since you’re using the Requests library, you should use it on each API. Requests provides a method to extract JSON, so you
Recreate POST request with WebKitFormBoundary using Python’s requests
I am attempting to scrape some data from a website using a POST request with the Python requests library. Unfortunately I am unable to post a link to the page as you must be signed in to the website to site to use it. The request I am trying to replicate has the file extension .ehtml and this is part
Using Python decorators to retry request
I have multiple functions in my script which does a REST API api requests.As i need to handle the error scenarios i have put a retry mechanism as below. I have several different methods which does similar operation. How can we do it better way to avoid duplication may be using decorators. Answer Instead of using decorators, the probably better
How do I scrape a full instagram page in python?
Long story short, I’m trying to create an Instagram python scraper, that loads the entire page and grabs all the links to the images. I have it working, only problem is, it only loads the original 12 photos that Instagram shows. Is there anyway I can tell requests to load the entire page? Working code; Answer As Scratch already mentioned,