
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
A go-to production API response with an easy format for building APIs with Python.
A go-to production API response with an easy format for building APIs with Python.
To get it running, follow the steps below:
1). Pip install the package in your project terminal:
pip install rest-api-response
2). In the file (.py) that you wish to use it, import it:
from rest_api_response import success_response, error_response
That's pretty much it - you can now call the function and pass the required arguments!
Suppose you have an API class that returns a list of blog posts to a client:
# imports goes here
...
class PostListAPIView(views.APIView):
serializer_class = PostSerializer
def get(self, request):
"""Returns a list of posts"""
posts = Post.objects.all()
serializer = self.serializer_class(posts, many=True)
return Response(serializer.data)
The API response would be:
[
{
"title": "First blog post",
"content": "Lorem ipsume content",
"author": 1
},
{
"title": "Second blog post",
"content": "Lorem ipsume content",
"author": 2
},
{
"title": "Third blog post",
"content": "Lorem ipsume content",
"author": 3
}
]
This works too, but let's take the response to the next level by doing this:
# imports goes here
...
from rest_api_response import success_response
class PostListAPIView(views.APIView):
serializer_class = PostSerializer
def get(self, request):
"""Returns a list of posts"""
posts = Post.objects.all()
serializer = self.serializer_class(posts, many=True)
_response = success_response(
message="Post retrieved!",
data=serializer.data
)
return Response(data=_response, status=status.HTTP_200_OK)
The API response would be:
[
"status": true,
"message": "Posts retrieved!",
"data": [
{
"title": "First blog post",
"content": "Lorem ipsume content",
"author": 1
},
{
"title": "Second blog post",
"content": "Lorem ipsume content",
"author": 2
},
{
"title": "Third blog post",
"content": "Lorem ipsume content",
"author": 3
}
]
]
And that's it. You have a nicely catchy response. :-)
All contributions are welcome:
New issue
with the enhancement
tag.README
and create a New issue
with the details or fork the project and do a Pull Request.FAQs
A go-to production API response with an easy format for building APIs with Python.
We found that rest-api-response demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.