mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-16 02:02:53 -07:00
Standardize string formatting to use .format instead of concat
This commit is contained in:
parent
a3a59af3f8
commit
2ad9f2e35f
18 changed files with 259 additions and 239 deletions
|
@ -1,6 +1,7 @@
|
|||
# coding=utf-8
|
||||
|
||||
import requests
|
||||
from six import iteritems
|
||||
|
||||
|
||||
class GitHub(object):
|
||||
|
@ -19,10 +20,11 @@ class GitHub(object):
|
|||
Access the API at the path given and with the optional params given.
|
||||
"""
|
||||
|
||||
url = 'https://api.github.com/' + '/'.join(path)
|
||||
url = 'https://api.github.com/{path}'.format(path='/'.join(path))
|
||||
|
||||
if params and type(params) is dict:
|
||||
url += '?' + '&'.join([str(x) + '=' + str(params[x]) for x in params.keys()])
|
||||
url += '?{params}'.format(params='&'.join(['{key}={value}'.format(key=k, value=v)
|
||||
for k, v in iteritems(params)]))
|
||||
|
||||
data = requests.get(url, verify=False)
|
||||
|
||||
|
@ -59,6 +61,6 @@ class GitHub(object):
|
|||
Returns a deserialized json object containing the compare info. See http://developer.github.com/v3/repos/commits/
|
||||
"""
|
||||
access_API = self._access_API(
|
||||
['repos', self.github_repo_user, self.github_repo, 'compare', base + '...' + head],
|
||||
['repos', self.github_repo_user, self.github_repo, 'compare', '{base}...{head}'.format(base=base, head=head)],
|
||||
params={'per_page': per_page})
|
||||
return access_API
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue