Personal access token accesses the Git API

Source: Internet
Author: User

The Git API stores a lot of useful repository information for everyone, and the most important thing is that you can crawl it down and make it easy with Python, but there's an access limit when accessing the Git API.,没有认证的访问每小时只能进行60次。。。所以需要认证一下。

The simple way to do this is to add parameters to the Requsets, and the parameters are your client_id and Client_secret. Here's a Python demo:

Response=requsets.get ('https://api.github.com/repos/your_name/your_reponame/whatever' , params={'client_id': your_client_id,'client_secret' : Your_client_secret}) Print  (response.headers['x-ratelimit-remaining') # See how many visits are left

That's it, client_id and Client_secret are all set in Settings.

There is another simple way is to use personal access token, where only set params={' Access_token ': Your_access_token} is OK. Access_token can also be set in Settings, but you can only look at it at a glance (you'll know when you set it), so you could save it.

OK, but there is a problem, even if you are authenticated login, your visit is only 5000/h, so to climb a large project may also need other methods (who have a good method also please enlighten), of course, to the page forcibly crawl, I think it is also possible ...

(PS: How did not find the function of publishing please ...) )

Personal access token accesses the Git API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.