外文分享

How to make the Apify Crawler to scroll full page when web page have infinite scrolling?

妖精的绣舞 提交于 2021-02-19 16:05:14
问题 I'm facing a problem that I unable to get all the product data as the website using a lazy load on product catalog page. meaning it needs to scroll until the whole page loaded. I getting only first-page products data. 回答1: First, you should keep in mind that there are infinite ways that infinite scroll can be implemented. Sometimes you have to click buttons on the way or do any sort of transitions. I will cover only the most simple use-case here which is scrolling down with some interval and

Delete an object automatically after 5 minutes

别来无恙 提交于 2021-02-19 16:05:06
问题 I'm trying to create a function that automatically delete an object after 5 minutes from publication. from django.contrib.gis.db import models from django.utils import timezone import datetime class Event(models.Model): name = models.CharField( max_length=100, ) publishing_date = models.DateTimeField( default=timezone.now, blank=True, ) @property def delete_after_five_minutes(self): time = self.publishing_date + datetime.timedelta(minutes=5) if time > datetime.datetime.now(): e = Event

How to fetch a single entry from Contentful and query by field value?

一个人想着一个人 提交于 2021-02-19 16:04:58
问题 I am trying to retrieve a single entry based on the name custom field of my entry. I have tried using the JS SDK with various options: client.getEntry("entryID") // .where("content_type", "Restaurant") // .where("fields.name[match]", "RestaurantName") // .all() .then(data => console.log('data', data)) .catch(err => console.log('err', err)) But based on the errors back, it's suggesting I can only use .getEntry and pass in the entry ID. I also looked at making an HTTP request with axios but

Bundler using wrong Ruby version

本秂侑毒 提交于 2021-02-19 16:04:54
问题 When I try to start my Rails server, I get the following error: $ bundle exec rails s Your Ruby version is 2.3.7, but your Gemfile specified ~> 2.3.8 I don't understand why that happens though, since I set Ruby to 2.3.8 both using Homebrew and using rbenv. 2.3.7 is the version of the system's ruby. I am using Mac OS 10.14.4. $ ruby -v ruby 2.3.8p459 (2018-10-18 revision 65136) [x86_64-darwin18] $ rbenv version 2.3.8 (set by /Users/ceasar/foo/.ruby-version) $ which -a ruby /Users/ceasar/.rbenv

How to make the Apify Crawler to scroll full page when web page have infinite scrolling?

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-19 16:04:43
问题 I'm facing a problem that I unable to get all the product data as the website using a lazy load on product catalog page. meaning it needs to scroll until the whole page loaded. I getting only first-page products data. 回答1: First, you should keep in mind that there are infinite ways that infinite scroll can be implemented. Sometimes you have to click buttons on the way or do any sort of transitions. I will cover only the most simple use-case here which is scrolling down with some interval and

How do I alias python2 to python3 in a docker container?

China☆狼群 提交于 2021-02-19 16:03:31
问题 I am trying to set the default python in my docker container to be python3 and have set the aliases in the dockerfile. When I open the .bashrc file, they show up. As far as I can tell, it should work but the default python version is still 2.7. if I run which python, it will still point to usr/bin/python rather than python3. Same with pip. Can anyone tell me what the problem is? Here is the command I'm using to alias: RUN \ echo 'alias python="/usr/bin/python3"' >> /root/.bashrc && \ echo

How do I alias python2 to python3 in a docker container?

ⅰ亾dé卋堺 提交于 2021-02-19 16:02:55
问题 I am trying to set the default python in my docker container to be python3 and have set the aliases in the dockerfile. When I open the .bashrc file, they show up. As far as I can tell, it should work but the default python version is still 2.7. if I run which python, it will still point to usr/bin/python rather than python3. Same with pip. Can anyone tell me what the problem is? Here is the command I'm using to alias: RUN \ echo 'alias python="/usr/bin/python3"' >> /root/.bashrc && \ echo

How do I alias python2 to python3 in a docker container?

ε祈祈猫儿з 提交于 2021-02-19 16:01:22
问题 I am trying to set the default python in my docker container to be python3 and have set the aliases in the dockerfile. When I open the .bashrc file, they show up. As far as I can tell, it should work but the default python version is still 2.7. if I run which python, it will still point to usr/bin/python rather than python3. Same with pip. Can anyone tell me what the problem is? Here is the command I'm using to alias: RUN \ echo 'alias python="/usr/bin/python3"' >> /root/.bashrc && \ echo

How to fetch a single entry from Contentful and query by field value?

£可爱£侵袭症+ 提交于 2021-02-19 16:01:13
问题 I am trying to retrieve a single entry based on the name custom field of my entry. I have tried using the JS SDK with various options: client.getEntry("entryID") // .where("content_type", "Restaurant") // .where("fields.name[match]", "RestaurantName") // .all() .then(data => console.log('data', data)) .catch(err => console.log('err', err)) But based on the errors back, it's suggesting I can only use .getEntry and pass in the entry ID. I also looked at making an HTTP request with axios but

TFS 2017- Release deploy app to IIS under a website

谁说我不能喝 提交于 2021-02-19 16:00:58
问题 I am using TFS 2017 build and realease to deploy a website, In my IIS i have the following Structure - WebsiteHost - ApplicationToDeploy I am using Deploy IIS App step on TFS realease definition Question : how can I tell the realease build to update ApplicationToDeploy under WebsiteHost ? Right now it creates a new Website on WebsiteHost level which i don't want. I tried WebsiteHost\ApplicationToDeploy in Host name field in the task but that just created a website with Host name WebsiteHost