Beispiel #1
0
    def save(self, *args, **kwargs):
        if not self.id:
            self.created_at = utility.get_current_time()
        self.updated_at = utility.get_current_time()

        self.tracking_id = uuid.uuid4()
        self.body = self.body + Email.get_open_tracking_link(self.tracking_id)
        self.body = self.body.replace("EMAIL_CLICK_TRACKING", Email.get_click_tracking_link(self.tracking_id))
        self.reply_to = self.reply_to + ';' + self.sender if self.reply_to else self.sender
        super().save(*args, **kwargs)
Beispiel #2
0
    def scrap_list(self):
        data = {'refreshed_at': utility.get_current_time(), 'packages': []}
        self.browser.get(CONFIG_DATA['PLAYSTORE_LIST_PAGE_LINK'])

        for category in [
                'TOP_FREE_APPS', 'TOP_PAID_APPS', 'TOP_GROSSING_APPS',
                'TOP_FREE_GAMES', 'TOP_PAID_GAMES', 'TOP_GROSSING_GAMES'
        ]:
            try:
                category_div = self.browser.find_element_by_css_selector(
                    CONFIG_DATA[f"LIST_{category}"])
            except Exception as e:
                app_logger.exception(e)
                continue

            for child in category_div.find_elements_by_css_selector('*'):
                if child.tag_name == 'a':
                    link = child.get_attribute('href')
                    if link and 'details?id=' in link and len(
                            link.split("details?id=")) > 1:
                        package_name = link.split("details?id=")[-1]
                        if package_name not in [
                                a['package_name'] for a in data['packages']
                        ]:
                            data['packages'].append({
                                'category':
                                category,
                                'package_name':
                                package_name
                            })
        app_logger.info(data)
        self.browser.quit()
        return data
Beispiel #3
0
def mark_email_clicked(request):
    if request.GET.get('eid'):
        email = Email.objects.get(tracking_id=request.GET.get('eid'))
        d = {
            'created_at': utility.get_current_time(),
            'email': email.id,
            'type': EMAIL_CLICK_EVENT[0]
        }
        ser = EmailEventSerializer(data=d)
        ser.is_valid(raise_exception=True)
        ser.save()
        return HttpResponse({'message': 'Thank you for using Finshots.'},
                            status=200)
    else:
        return HttpResponse({'error': 'There is some problem with the link.'},
                            status=400)
Beispiel #4
0
def mark_read_email(request):
    if request.GET.get('eid'):
        email = Email.objects.get(tracking_id=request.GET.get('eid'))
        d = {
            'created_at': utility.get_current_time(),
            'email': email.id,
            'type': EMAIL_OPEN_EVENT[0]
        }
        ser = EmailEventSerializer(data=d)
        ser.is_valid(raise_exception=True)
        ser.save()
        return HttpResponse({'message': 'Thank you for using Finshots.'},
                            status=200)
    red = Image.new('RGBA', (1, 1), (255, 0, 0, 0))
    res = HttpResponse(content_type="image/png")
    red.save(res, "JPEG")
    return res
Beispiel #5
0
 def save(self, *args, **kwargs):
     if not self.id:
         self.created_at = utility.get_current_time()
     self.updated_at = utility.get_current_time()
     super().save(*args, **kwargs)