sachin-sankar / swiftshadow

Free IP Proxy rotator library for python
https://sachin-sankar.github.io/swiftshadow/
GNU General Public License v3.0
72 stars 5 forks source link

Remove unnecessary loop and change saved file format to JSON #8

Closed ShrirajHegde closed 1 year ago

ShrirajHegde commented 1 year ago
  1. Remove unnecessary blocking loop
  2. Use JSON instead of pickling
  3. Use seconds for cachePeriod
  4. Fix .gitignore file extension
ShrirajHegde commented 1 year ago

@ShrirajHegde Although it's easy to use seconds it is very inefficient if you set your cache period below 3 minutes as it takes almost a minute sometimes to update the cache. So can you revert back to minutes?

This is not the way to solve it the problem, maybe warn the user about the problem. Users can always set seconds/60, you will just be making it an inconvenience.

Always use seconds and use warnings.warn to warn users about short cachePeriod. Also, with 10 proxies, it took around 12-16 seconds for me. Just warn while creating the object if the cachePeriod shorter is 3*60 = 180.

Or to avoid the confusion altogether you can ask for a timedelta object instead of an int.