当前位置: 首页 > 软件库 > 大数据 > 数据查询 >

pyquery-ql

Query GitHub API v4 using GraphQL
授权协议 MIT License
开发语言 Java
所属分类 大数据、 数据查询
软件类型 开源软件
地区 不详
投 递 者 习胤运
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

pyquery-ql

Query GitHub API v4 using a lightweightGraphQL client

What is pyquery-ql?

It's a repository for examples and tips when querying GraphQL APIs usingPython and the popular Jupyternotebook. It provides examples on using theelegant requests library and pandas to do datacollection and interactivedata exploration.

pyquery-ql is also a very early prototype for a lightweight PythonGraphQL client. It's based on Python 3.6 or higher and takes advantage off-strings (if you haven't tried them yet, please do).

Why create a lightweight GraphQL client for Python?

In data science and scientific programming, we do lots of queries for datafrom different sources. With the increased use of GraphQL, it's helpful tohave a lightweight client to do quick queries.

With Jupyter and nteractnotebooks, it's critical to one's workflow to beable to prototype and iterate from within the notebook. While full featuredclients, like Apollo Client, andexplorers, such as GitHub's GraphQL Explorer,are wonderful, the user must leave the notebook to see their benefits.

Using the Jupyter or nteract notebooks, a user explores data, and GraphQL isfun to use since it's very easy to introspect the data source. A lightweightPython client provides a simple way to bridge the data andthe Python scientific stack, especially pandas, from within the interactivenotebook.

Installation

Supports Python 3.6+

  1. Clone the repo.

     git clone https://github.com/willingc/pyquery-ql.git
    
  2. Set up your GitHub API token to avoid rate limit and export to yourenvironment:

     export GITHUB_API_TOKEN = '......'
    

pip installation instructions

  1. From the root of the cloned repo:

     pip install -r requirements.txt
    

conda installation instructions

  1. Create the conda environment:

     conda env create -f environment.yml
    
  2. Activate the environment:

     source activate pyquery
    

Usage

To run:

python3 pyquery-ql.py

License

MIT


GraphQL info

  • GraphQL

    • describe your data
    • ask for what you want
    • get predictable results
  • A GraphQL service defines typesand fields on those types. A function is created for each field oneach type.

    • field can be a specific type (like String) or an Object
    • arguments can be passed to fields when making a query
      {
        human(id: "1000") {
          name
          height
        }
      }
      
      
  • GraphQL schema and types

    type Character {
      name: String!
      appearsIn: [Episode]!
    }
    
    • GraphQL Object type Character
    • fields name and appearsIn
    • Scalar type String
    • ! non-nullable (will always return a value when queried)
    • array [Episode]
  • Arguments

    • every field can have 0 or more arguments
    • all arguments are named
    • all arguments are passed by name specifically (unlike JS or Pythonwhere functions take a list of ordered arguments
    • required or optional
  • Scalar types

    • fields that resolve to real data
    • leaves of the query
    • default scalar types:
      • Int
      • Float
      • String
      • Boolean
      • ID unique identifier
    • custom scalar types are possible i.e. Date
    • Enums
  • Modifiers: Non-Null and List (array)

    • List [] can be null
    • a member of the list can not be null or it will generate an error
    • []! the actual list can not be null though a member can be null
  • Introspection is a beautifulthing; ask for __schema for all the good stuff on the types

GraphQL Client - deeper dive

  • Pagination
    • plurals
    • slicing
    • pagination and edges
    • Connections
  • Caching
    • ID
    • pros and cons of globally unique IDs
    • server defined or client derived are both options

GraphQL spec

  • pyquery pyqyery允许你对xml文档进行jquery查询,API尽可能类似jquery,pyquery使用lxml进行快速xml和html操作 pyquery是python中强大而又灵活的网页解析库,如果你觉得正则写起来太麻烦,有觉得beautifulsoup语法太难记,如果你熟悉jquery的语法那么,pyquery就是你的绝佳的选择 初始化 基于标签选择器 html = ''' <

  • 1.安装库 pip install pyquery 2.pyquery基本使用 2.1 导入库 from pyquery import PyQuery # 加载html内容 p=PyQuery(html) 3. 元素查找 3.1 css选择器查找 a=p('a') 3.2 链式查找 a=p('li')('a') 3.3 后代选择器查找 a=p('li a') 3.4 类元素查找 a1=p

  • 三:PyQuery: # pyquery:仿照jquery语法,封装的一个包,和bs4有点类似。 from pyquery import PyQuery html = """ <div id='content'> <ul class='list'> <li class='one'>One</li> <li class='t

  • PyQuery """ 强大又灵活的网页解析库 pip install pyquery 官方文档 http://pyquery.readthedocs.io/ API风格和前段jquery 相似 """ 初始化 字符串初始化 html = ''' <div> <ul> <li class="item-0">first item</li> <li cl

  • PyQuery 初始化 字符串初始化 html = ''' <div> <ul> <li class="item-0">first item</li> <li class="item-1"><a href="link2.html">second item</a></li> <li class="item-0 active"><a hre

  • class pyquery.pyquery.PyQuery(*args, **kwargs) 类pyquery.pyquery.PyQuery (* args,** kwargs ) 主要类    Fn 类              构建自定义函数(如jQuery.fn): >>> fn = lambda: this.map(lambda i, el: PyQuery(this).outerHtm

  • 前言:pyQuery强大又灵活的网页解析库。如果你觉得正则写起来太麻烦,如果你觉得BeautifulSoup语法太难记,如果你熟悉jQuery的语法,那么pyQuery就是你的绝佳选择。   ·导入方法from pyquery import PyQuery as pq(这里由于PyQuery书写繁琐,就用pq代替) doc = pq(‘url’) print(doc('li'))这里跟css选择器

  • 下载地址:https://pypi.python.org/pypi/pyquery/#downloads 下载后安装: C:\Python27>easy_install E:\python\pyquery-1.2.4.zip 也可以直接在线安装: C:\Python27>easy_install pyquery 输出如下: C:\Python27>easy_install pyquery Sear

  • 在本教程中,您将了解PyQuery ,这是一个Python库,可用于对XML文档进行jQuery查询。 从语法上讲,它与jQuery非常相似,并且如果您熟悉jQuery,则应该更容易理解。 PyQuery入门 要开始使用PyQuery ,请使用PIP安装Python软件包。 pip install pyquery 一旦安装了PyQuery ,将其导入到Python程序中。 from pyquery

  • PyQuery库也是一个非常强大又灵活的网页解析库,如果你有前端开发经验的,都应该接触过jQuery,那么PyQuery就是你非常绝佳的选择,PyQuery 是 Python 仿照 jQuery 的严格实现。语法与 jQuery 几乎完全相同,所以不用再去费心去记一些奇怪的方法了。 官网地址:http://pyquery.readthedocs.io/en/latest/ pyquery的安装,可

  • sudo apt-get install libxml2-dev libxslt1-dev python-dev sudo pip install pyquery

  • pyquery是一个类似jquery的工具,不过它是在服务端进行处理的,不像jquery是在浏览器中进行处理。如果我们要进行网络爬虫,爬取有用的信息,那么它是我至今见到的不二选择。我们当然可以自己爬取网页,然后可以通过正则表达式,选取有用的信息,但这其实要求挺高的。我以前也做过爬虫工具,专门抓取招聘网站的招聘信息,但我发先我以前做的实在是复杂。而我们程序员很重要的一点是,不要重复的发明轮子,我们只

  • 目录: 前言 该文章为学习崔dalao教程时,做的一些笔记。 好记性不如烂笔头 简介 PyQuery库也是一个非常强大又灵活的网页解析库,前端基础较好的人,使用更加方便,上手快,且功能更强大。 官方文档: http://pyquery.readthedocs.io/ 使用 初始化 字符串初始化 URL初始化 文件初始化 (对于本机文件) # 演示数据 html = ''' <div id="

  • As Python is my programming language of choice when it comes to getting things done quickly, I need a dead simple XML parser that gets me the data I want and gets the hell out of the way. Enter PyQuer

  •  pyquery是一个类似jquery的工具,不过它是在服务端进行处理的,不像jquery是在浏览器中进行处理。如果我们要进行网络爬虫,爬取有用的信息,那么它是我至今见到的不二选择。我们当然可以自己爬取网页,然后可以通过正则表达式,选取有用的信息,但这其实要求挺高的。我以前也做过爬虫工具,专门抓取招聘网站的招聘信息,但我发先我以前做的实在是复杂。而我们程序员很重要的一点是,不要重复的发明轮子,我们

  • PyQuery 库是一个非常强大又灵活的网页解析库,如果你有前端开发经验,那么你应该接触过 jQuery ,那么PyQuery就是你非常绝佳的选择,PyQuery 是 Python 仿照 jQuery 的严格实现,语法与 jQuery 几乎完全相同。 安装 跟安装其他库一样: >>> pip3 install pyquery 安装了之后,在程序里面就可以引用了,引用方法跟其他库类似: from

 相关资料
  • PyQuery 让你使用 jQuery 的风格来遍历 XML 文档,它使用了 lxml 来处理 XML 乃至 HTML 文档。 你可以直接从字符串、URL或者文件中加载文档: >>> from pyquery import PyQuery as pq>>> from lxml import etree>>> import urllib>>> d = pq("<html></html>")>>> d

  • ① PyQuery介绍与安装 PyQuery库也是一个非常强大又灵活的网页解析库,如果你有前端开发经验的,都应该接触过jQuery,那么PyQuery就是你非常绝佳的选择。 PyQuery 是 Python 仿照 jQuery 的严格实现。 语法与 jQuery 几乎完全相同,所以不用再去费心去记一些奇怪的方法了。 官网地址:http://pyquery.readthedocs.io/en/lat

  • 我对python有点陌生,但我正在尝试制作一个web scraper脚本,它可以在网站上下载所有图片。我正在使用requests和PyQuery,因为许多人在做了一些研究后推荐了它。这就是我现在所拥有的,我不知道该去哪里。 我知道我需要获取img的来源,但在找到img标签后如何做到这一点?此外,我查看了一些htmls的页面源,一些图片存储在他们的数据库中,因此src以“/”开头一些扩展“所以我想知

  • 本文向大家介绍python中PyQuery库用法分享,包括了python中PyQuery库用法分享的使用技巧和注意事项,需要的朋友参考一下 PyQuery库就是python中的一个解析库。作用十分强大,使用上也是相当的灵活,能够实现初始化字符串、初始化 HTML 文件、初始化请求响应等多种场景,另外,本身中的CSS选择器,也是经常被大家使用的对象,结合以上的大致内容总结,接下来,我们一起详细的了解

  • 本文向大家介绍python3解析库pyquery的深入讲解,包括了python3解析库pyquery的深入讲解的使用技巧和注意事项,需要的朋友参考一下 前言 pyquery是一个类似jquery的python库,它实现能够在xml文档中进行jQuery查询,pyquery使用lxml解析器进行快速在xml和html文档上操作,它提供了和jQuery类似的语法来解析HTML文档,支持CSS选择器,使

  • 本文向大家介绍Python爬虫PyQuery库基本用法入门教程,包括了Python爬虫PyQuery库基本用法入门教程的使用技巧和注意事项,需要的朋友参考一下 本文实例讲述了Python爬虫PyQuery库基本用法。分享给大家供大家参考,具体如下: PyQuery库也是一个非常强大又灵活的网页解析库,如果你有前端开发经验的,都应该接触过jQuery,那么PyQuery就是你非常绝佳的选择,PyQu