Skip to content

Instantly share code, notes, and snippets.

View LegolasVzla's full-sized avatar
🤓
Focusing

Manuel Carrero LegolasVzla

🤓
Focusing
View GitHub Profile
@LegolasVzla
LegolasVzla / list_postman_endpoints.py
Last active May 3, 2020 01:38
List all your postman endpoints with a pretty and clean format
import json
#import pprint
import os
'''
Assuming that you exported your postman collection in your current path
or you can delete os.getcwd() and put the full path of your postman
collection exported file
'''
current_path=os.getcwd()
@LegolasVzla
LegolasVzla / request_validator.txt
Last active November 20, 2020 15:29
Django, Django Rest Framework, Postman validator of type of request in a Class Based View (API)
'''
When you're developing an Endpoint with Django Rest Framework, in some situations you'll want to re-use it for generating example data, make tests (e.g. in DRF API View, Postman, Swagger IO...) and also to use it in your web app. For that reason, you'll receive differents types of request. On way to handle with this problem, is to create a decorator method to validate the type of request and then, in your CFA or CVB call the decorator.
_instance= MyNameViewSet()
_instance.endpoint_name(request,param1=1,param2=1)
'''
# Request validation is like that:
from functools import wraps