Repository: Flexget/Flexget

Issue:
Pyload, error when checking version.

<!---
Before opening an issue, verify:

- Is this a feature request? Post it on https://feathub.com/Flexget/Flexget
No.
- Is this an issue with webui? Make an issue over on https://github.com/Flexget/webui
No.
- Did you recently upgrade? Look at the Change Log and Upgrade Actions to make sure that you don't need to make any 
changes to your config https://flexget.com/ChangeLog https://flexget.com/UpgradeActions
No.
- Are you running FlexGet as a daemon? Stop it completely and then start it again https://flexget.com/CLI/daemon
Yes.
- Did you search to see if the issue already exists? https://github.com/Flexget/Flexget/issues
Yes.
- Did you fill out the issue template as completely as possible?
Yes!?

The issue template is here because it helps to ensure you submitted all the necessary information the first time, and allows us to more quickly review issues. Please fill it out correctly and do not ignore it, no matter how irrelevant you think it may be. Thanks in advance for your help with this!
--->
When there are accepted entries and the version check, an error occurs, I put it in the pastbin, the error aparently is related with this PR  #2642

### Expected behaviour:
Add entries and download.

<!---
Please don't just say "it doesn't crash" or "it works". Explain what the expected result is.
--->

### Actual behaviour:
PASTBIN: https://pastebin.com/R3Hk3zSh

### Steps to reproduce:
- Step 1: ...
When I run a task with the pyload plugin and there are accepted entries.

#### Config:
```yaml--- config from task: pyload
accept_all: true
metainfo_series: true
pyload:
  api: http://localhost:8000/api
  enabled: true
  folder: /media/luiz/HD/Downloads
  hoster:
    - MegauploadComFolder
    - MegauploadCom
    - ZippyshareCom
  package: '{{series_name}} - {{tvdb_series_name}}'
  parse_url: true
  password: admin
  queue: true
  username: luiz
rss:
  all_entries: true
  ascii: false
  escape: false
  group_links: false
  silent: false
  url: /home/luiz/.flexget/rss.xml
thetvdb_lookup: true
trakt_lookup: true

---

```
  
#### Log:
<details>
 <summary>https://pastebin.com/R3Hk3zSh</summary>

```
paste log output here
```
</details>

### Additional information:

- FlexGet version: 3.1.67.dev
- Python version: Python 3.8.2
- Installation method: git venv
- Using daemon (yes/no): yes
- OS and version: Linux HP 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
- Link to crash log: https://pastebin.com/R3Hk3zSh

<!---
In config and debug/crash logs, remember to redact any personal or sensitive information such as passwords, API keys, private URLs and so on.

Please verify that the following data is present before submitting your issue:

- Link to a paste service or paste above the relevant config (preferably full config, including templates if present). Please make sure the paste does not expire, if possible.
- Link to a paste service or paste above debug-level logs of the relevant task/s (use `flexget -L debug execute --tasks <Task_name>`).
- FlexGet version (use `flexget -V` to get it).
- Full Python version, for example `2.7.11` (use `python -V` to get it). 
- Installation method (pip, git install, etc).
- Whether or not you're running FlexGet as a daemon.
- OS and version.

- Attach crash log if one was generated, in addition to the debug-level log. It can be found in the directory with your config file.
--->



Discussion:

Resolving patch:
diff --git a/flexget/plugins/clients/pyload.py b/flexget/plugins/clients/pyload.py
--- a/flexget/plugins/clients/pyload.py
+++ b/flexget/plugins/clients/pyload.py
@@ -123,15 +123,6 @@ def on_task_output(self, task, config):
 
         self.add_entries(task, config)
 
-    @staticmethod
-    def get_version_from_packaging():
-        version = None
-        try:
-            from packaging import version
-        except ModuleNotFoundError:
-            logger.warning('packaging is not installed')
-        return version
-
     def add_entries(self, task, config):
         """Adds accepted entries"""
 
@@ -147,26 +138,18 @@ def add_entries(self, task, config):
         except Exception as e:
             raise plugin.PluginError('Unknown error: %s' % str(e), logger)
 
-        remote_version = None
-        try:
-            remote_version = api.get('getServerVersion')
-        except RequestException as e:
-            if e.response is not None and e.response.status_code == 404:
-                remote_version = json.loads(api.get('get_server_version').content)
-            else:
-                raise e
-
+        # old pyload (stable)
+        is_pyload_ng = False
         parse_urls_command = 'parseURLs'
         add_package_command = 'addPackage'
         set_package_data_command = 'setPackageData'
 
-        is_pyload_ng = False
-        version = self.get_version_from_packaging()
-        if version and version.parse(remote_version) >= version.parse('0.5'):
+        # pyload-ng is returning dict instead of session string on login
+        if isinstance(session, dict):
+            is_pyload_ng = True
             parse_urls_command = 'parse_urls'
             add_package_command = 'add_package'
             set_package_data_command = 'set_package_date'
-            is_pyload_ng = True
 
         hoster = config.get('hoster', self.DEFAULT_HOSTER)
 


Test patch: