Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-lister
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antoine R. Dumont
swh-lister
Commits
5a08bb72
Commit
5a08bb72
authored
7 years ago
by
Nicolas Dandrimont
Browse files
Options
Downloads
Patches
Plain Diff
lister_trasnports: send a custom http user agent
parent
5eca777c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/lister/core/lister_transports.py
+5
-1
5 additions, 1 deletion
swh/lister/core/lister_transports.py
with
5 additions
and
1 deletion
swh/lister/core/lister_transports.py
+
5
−
1
View file @
5a08bb72
...
...
@@ -9,6 +9,7 @@ from email.utils import parsedate
from
pprint
import
pformat
import
requests
import
vcversioner
import
xmltodict
from
.abstractattribute
import
AbstractAttribute
...
...
@@ -36,7 +37,9 @@ class SWHListerHttpTransport(abc.ABC):
MAY BE OVERRIDDEN if request headers are needed.
"""
return
{}
return
{
'
User-Agent
'
:
'
Software Heritage lister (%s)
'
%
self
.
lister_version
}
def
transport_quota_check
(
self
,
response
):
"""
Implements SWHListerBase.transport_quota_check with standard 429 code
...
...
@@ -65,6 +68,7 @@ class SWHListerHttpTransport(abc.ABC):
raise
NameError
(
'
HTTP Lister Transport requires api_baseurl.
'
)
self
.
api_baseurl
=
api_baseurl
# eg. 'https://api.github.com'
self
.
session
=
requests
.
Session
()
self
.
lister_version
=
vcversioner
.
find_version
().
version
def
transport_request
(
self
,
identifier
):
"""
Implements SWHListerBase.transport_request for HTTP using Requests.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment