Peer to Peer code along with test script (#18)

* Initial Peer service code

* Updated peer service

* Updated peer service

* Updated file service

* Updated User Ip registration

* Updated File moving function

* test

* test1 again

* new

---------

Co-authored-by: Sahej Panag <spanag3@gatech.edu>
This commit is contained in:
Aman Tahiliani
2024-04-22 00:42:08 -04:00
committed by GitHub
parent 56318a74da
commit 094a8d763f
7 changed files with 170 additions and 3 deletions

View File

@@ -66,7 +66,13 @@ class PollOnlineView(APIView):
def post(self, request):
try:
user = request.user
ip_address = get_client_ip(request)
try:
data = request.data
ip_address = data['ip']
print("Local IP found in request")
except Exception as e:
ip_address = get_client_ip(request)
print("Using public IP")
user.ip_address = ip_address
user.last_poll = timezone.now()
user.save()