26 lines
963 B
Python
26 lines
963 B
Python
|
from django.db import models
|
||
|
from django.utils import timezone
|
||
|
from datetime import timedelta
|
||
|
|
||
|
# Create your models here.
|
||
|
|
||
|
class DockerhubCrawler(models.Model):
|
||
|
url = models.CharField(max_length=300)
|
||
|
|
||
|
api_url = models.CharField(max_length=1000, null= True, blank=True)
|
||
|
last_pushed = models.DateTimeField(null= True, blank=True)
|
||
|
last_updated = models.DateTimeField(null= True, blank=True)
|
||
|
def __str__(self):
|
||
|
return self.url
|
||
|
|
||
|
def save(self, *args, **kwargs):
|
||
|
split_string = self.url.split("/")
|
||
|
print(split_string)
|
||
|
self.api_url = 'https://hub.docker.com/v2/repositories/' + split_string[4] +'/' \
|
||
|
+ split_string[5] + '/tags/?page=1&page_size=10'
|
||
|
super(DockerhubCrawler, self).save(*args, **kwargs)
|
||
|
|
||
|
# Research , via Chrome dev tools ;)
|
||
|
#https://hub.docker.com/r/vectorim/element-web/tags
|
||
|
#https://hub.docker.com/v2/repositories/vectorim/element-web/tags/?page=1&page_size=800
|