LoginSignup
1
1

More than 3 years have passed since last update.

【PyQuery】リクエストにヘッダを含める

Posted at

はじめに

Pythonのpyqueryを用いてWebスクレイピングを行っているが、GETクエリ等にユーザーエージェント情報の含めたくなって調べたので備忘録として残しておく。

方法

pyquery関数にヘッダ情報を含める事ができるので、そこに設定する。

from pyquery import PyQuery as pq
profile_query = pq(requests.get(profile_url, headers={'user-agent': 'pyquery'}).content)

参考

こちらの公式ドキュメントを参考。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1