Q sister brings you to earn extra money: a wave of high-quality welfare problems hit

Hello, everyone. I'm yours Must ask Sister Q.

What interesting and challenging topics did sister Q find today? Let's have a look.

Q1: How can Scrapy get the browser's temporary cookie s?

Problem Description:

How does the script get the same temporary cookie s as the browser?

For example, lv's official website needs to obtain temporary cookies to access the data. However, the cookies obtained by the summary and requests are different from those obtained by the browser, and access will be denied. Is there a big God who knows the difference between their cookies and how to solve it.

I'm going to rush to answer > > https://biwen.csdn.net/question/983

Q2: how to judge whether the value exists in the dictionary according to the database field

Problem Description:

Problem Description: now I have the data returned by a third-party service (as follows). I need to traverse the data stored in the ProductKey query database, and add the database ID to each dictionary in items. The effect is as follows. Now I have found the data,

product_key = []

for item in items:

product_key.append(item['ProductKey'])

data = Product.query.filter(Product.product_key.in_(product_key)).all()

print(data)        

# [<Product 4>, <Product 5>, <Product 6>, <Product 7>, <Product 8>, <Product 9>, <Product 10>, <Product 11>, <Product 12>, <Product 13>]

Question: now I need to take out the ID in the query list and throw it into the items dictionary. If I need to make a judgment, take out the ProductKey from the query list and compare it with the value of ProductKey in the items, then I can throw this data ID into it to prevent Zhang Guanli Dai from happening.

The database only stores ID and ProductKey, but the data returned by the third-party service does not have ID, so I need to add an ID to return to the front end...

I'm going to rush to answer > > https://biwen.csdn.net/question/980

Q3: Why not use a non root user when JDBC 5.1 is connected to MySQL 8.0?

Problem Description:

I'm going to rush to answer > > https://biwen.csdn.net/question/986

Q4: How to solve the problem of error reporting in pip installation?

Problem Description:

sudo pip install aiohttp

Exception:

Traceback (most recent call last):

 File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 143, in main

  status = self.run(options, args)

 File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 259, in run

  with self._build_session(options) as session:

 File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 79, in _build_session

  insecure_hosts=options.trusted_hosts,

 File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_internal/download.py", line 337, in __init__

  self.headers["User-Agent"] = user_agent()

 File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_internal/download.py", line 100, in user_agent

  zip(["name", "version", "id"], distro.linux_distribution()),

 File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_vendor/distro.py", line 120, in linux_distribution

  return _distro.linux_distribution(full_distribution_name)

 File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_vendor/distro.py", line 675, in linux_distribution

  self.version(),

 File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_vendor/distro.py", line 735, in version

  self.lsb_release_attr('release'),

I'm going to rush to answer > > https://biwen.csdn.net/question/979

Q5: sklearn's neural network, how to call the trained model?

Problem Description:

The following A is the establishment and training, B is the call and calculation

Tested with iris data, it's totally unexpected

What's wrong?

Click the question to see the specific code and results.

I'm going to rush to answer > > https://biwen.csdn.net/question/988

Go to the homepage of must ask, and more cash will be collected when you come to pass the border > > https://biwen.csdn.net/

Q sister is going to make money

17 original articles published, 54 praised, 30000 visitors+
Private letter follow

Keywords: pip Database JDBC MySQL

Added by bluegray on Thu, 27 Feb 2020 11:14:06 +0200