File: MainClass.rst

package info (click to toggle)
pygithub 2.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 33,476 kB
  • sloc: python: 38,409; sh: 7; makefile: 6
file content (81 lines) | stat: -rw-r--r-- 1,975 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Main Class
==========

This is the main class.

Get current user
----------------

.. code-block:: python

    >>> user = g.get_user()
    >>> user.login
    u'sfdye'

Get user by name
----------------

.. code-block:: python

    >>> user = g.get_user("sfdye")
    >>> user.name
    u'Wan Liuyang'

Get repository by name
----------------------

.. code-block:: python

    >>> repo = g.get_repo("PyGithub/PyGithub")
    >>> repo.name
    u'PyGithub'

Get organization by name
------------------------

.. code-block:: python

    >>> org = g.get_organization("PyGithub")
    >>> org.login
    u'PyGithub'

Get enterprise consumed licenses by name
----------------------------------------

.. code-block:: python

    >>> enterprise = g.get_enterprise_consumed_licenses("PyGithub")
    >>> enterprise_consumed_licenses = enterprise.get_enterprise_consumed_licenses()
    >>> enterprise_consumed_licenses.total_seats_consumed
    5000

Search repositories by language
-------------------------------

.. code-block:: python

    >>> repositories = g.search_repositories(query='language:python')
    >>> for repo in repositories:
    ...    print(repo)
    ...
    Repository(full_name="vinta/awesome-python")
    Repository(full_name="donnemartin/system-design-primer")
    Repository(full_name="toddmotto/public-apis")
    Repository(full_name="rg3/youtube-dl")
    Repository(full_name="tensorflow/models")
    Repository(full_name="django/django")

Search repositories based on number of issues with good-first-issue
-------------------------------------------------------------------

.. code-block:: python

    >>> repositories = g.search_repositories(query='good-first-issues:>3')
    >>> for repo in repositories:
    ...    print(repo)
    ...
    Repository(full_name="vuejs/vue")
    Repository(full_name="facebook/react")
    Repository(full_name="facebook/react-native")
    Repository(full_name="electron/electron")
    Repository(full_name="Microsoft/vscode")