Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/343.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将curl-get-to-restapi转换为python_Python_Python 3.x_Python Requests_Pagerduty - Fatal编程技术网

将curl-get-to-restapi转换为python

将curl-get-to-restapi转换为python,python,python-3.x,python-requests,pagerduty,Python,Python 3.x,Python Requests,Pagerduty,我有一个curl命令: curl -X GET --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'Authorization: Token token=y_NbAkKc66ryYTWUXYEu' 'https://api.pagerduty.com/services?time_zone=UTC&sort_by=name' 我需要使用请求库将其转换为python import requests d

我有一个curl命令:

curl -X GET --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'Authorization: Token token=y_NbAkKc66ryYTWUXYEu' 'https://api.pagerduty.com/services?time_zone=UTC&sort_by=name'
我需要使用
请求
库将其转换为python

import requests

def support(self): 
    services_list = requests.get('I need to convert the link to pass it here as a parameter')
import requests

def support():
    headers = {
        'Accept': 'application/vnd.pagerduty+json;version=2',
        'Authorization': 'Token token=y_NbAkKc66ryYTWUXYEu'}

    payloads = (
        ('time_zone', 'UTC'),
        ('sort_by', 'name'),)

    services_list = requests.get('https://api.pagerduty.com/services', headers=headers, params=payloads)