Categories
Mastering Development

Generate a certificate request and submit to a CA using only .Net

I am trying to use only .Net code to create a certificate request and submit the request to our on premise Active Directory PKI certificate authority, and get a certificate back. I have a solution that has been working for a few years, but it uses CERTCLILib and CERTENROLLLib, and I would like to shed […]

Categories
Mastering Development

Django Rest Framework append object to many to many field without deleting the previous one

I am new to DRF and could not figure out how to append an object to the many to many field without deleting the previous one. I am using PATCH to update the field MONITORS however the previous value gets substituted by the actual one. I want to append it. API GET is: { "id": […]

Categories
Mastering Development

HTTP 403 error when trying to download a file from URL using Python

I’m trying to download a file from the URL -> https://www.microsoft.com/en-us/download/confirmation.aspx?id=56519 I can manually download the file by accessing the URL via a browser and the file gets automatically saved onto the local machine in the Downloads folder. (The file is in JSON format) However, I need to achieve this using a Python script. I […]

Categories
Mastering Development

django annotation max min AND first last

From a datatable that stores the BTC price each minute, I’am trying to get an queryset objet that aggregate values by hours (need min, max, first and last). It works well for the max and min class BTCDayDataCandles(APIView): authentification_classes = [] permission_classes = [] def get(self, request, format=None): now = datetime.now() BTCData = BTCminute.objects\ .annotate(test […]

Categories
Mastering Development

How do I query a Foreign key, but in reverse and list them in Django Rest Framework?

I’m having a hard time getting my head around this for some reason. I know how to do this in plain Django, but not sure how to do this in DRF. class Novel(models.Model): name = models.CharField(max_length = 100) image = models.URLField(blank = True) linkNU = models.URLField(blank = True) author = models.ForeignKey(Author, on_delete = models.CASCADE, null […]

Categories
Mastering Development

Django REST Multiple Nested Serializer Filter

Is there a way to filter multiple nested serializers? I have a Student serializer that displays all of the students courses. The courses display all the homework and their scores. They way I want to design the backend is that every student will receive the same homework outline but only the scores change; so to […]

Categories
Mastering Development

File not being saved in specific folder in Flask

I am using flask to make a program and am trying to save the save files (images to be exact) in a specific directory. I want to save the files in this path – FlaskApp -> static -> images The app.py file is in the Flask app folder. This is the code I wrote import […]

Categories
Mastering Development

Using mnist library in Python

I need to use the mnist Python library for downloading and reading MNIST data (PyPi, Github): import mnist mnist_dataset = mnist.test_images().astype(np.float32) On my university cluster I load the data without problem. Locally on my PC, however, I get: ————————————————————————— HTTPError Traceback (most recent call last) <ipython-input-24-78f59b728818> in <module> 8 DATASET_SIZE = 512 9 DIGIT_SIZE = […]

Categories
Mastering Development

How to keep listening for a request at the same time process another request in python

So, it’a little complicated. What I am trying to do: Hosting an app on heroku and listening for webhooks sent by a messaging app (in JSON format) and saving them to a Database(SQLite3). Use that Database to generate ticket on zoho desk. If the ticket status is open I’ll update the ticket with the new […]

Categories
Mastering Development

how can i send the post ( request.body ) to another nodejs(client) via socket.io

Hello how can i emit the request.body to a nodejs-socket.io client ? with a another port ( not 80 ) const express = require("express"); const bodyParser = require("body-parser"); const router = express.Router(); const app = express(); //Here we are configuring express to use body-parser as middle-ware. app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.json()); router.post(‘/1’,(request,response) => { //code […]