diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-09-05 18:49:36 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-09-05 18:49:36 -0700 |
commit | 28d2d94a9100c1a809955cde93fdbb7a36263057 (patch) | |
tree | b61675cbd21f28da15dabf4361cf86bad565f1c4 /python | |
parent | 070069cb6eb71b92a9c4e46f3d4cfabb67f4eb3f (diff) | |
download | fatcat-28d2d94a9100c1a809955cde93fdbb7a36263057.tar.gz fatcat-28d2d94a9100c1a809955cde93fdbb7a36263057.zip |
refactor all python source for client lib name
Diffstat (limited to 'python')
58 files changed, 229 insertions, 229 deletions
diff --git a/python/fatcat_export.py b/python/fatcat_export.py index e3c141fd..1001dbf6 100755 --- a/python/fatcat_export.py +++ b/python/fatcat_export.py @@ -11,9 +11,9 @@ import sys import json import argparse -import fatcat_client -from fatcat_client.rest import ApiException -from fatcat_client import ReleaseEntity, ContainerEntity, ChangelogEntry +import fatcat_openapi_client +from fatcat_openapi_client.rest import ApiException +from fatcat_openapi_client import ReleaseEntity, ContainerEntity, ChangelogEntry from fatcat_tools import uuid2fcid, entity_from_json, entity_to_dict, \ public_api diff --git a/python/fatcat_tools/api_auth.py b/python/fatcat_tools/api_auth.py index 3c643cea..add03399 100644 --- a/python/fatcat_tools/api_auth.py +++ b/python/fatcat_tools/api_auth.py @@ -1,7 +1,7 @@ import os, sys -import fatcat_client -from fatcat_client.rest import ApiException +import fatcat_openapi_client +from fatcat_openapi_client.rest import ApiException def public_api(host_uri): @@ -10,9 +10,9 @@ def public_api(host_uri): if the API isn't going to be used, so it's important that it doesn't try to actually connect to the API host or something. """ - conf = fatcat_client.Configuration() + conf = fatcat_openapi_client.Configuration() conf.host = host_uri - return fatcat_client.DefaultApi(fatcat_client.ApiClient(conf)) + return fatcat_openapi_client.DefaultApi(fatcat_openapi_client.ApiClient(conf)) def authenticated_api(host_uri, token=None): """ @@ -20,7 +20,7 @@ def authenticated_api(host_uri, token=None): is needed, so it does try to connect and verify credentials. """ - conf = fatcat_client.Configuration() + conf = fatcat_openapi_client.Configuration() conf.host = host_uri if not token: token = os.environ['FATCAT_API_AUTH_TOKEN'] @@ -31,7 +31,7 @@ def authenticated_api(host_uri, token=None): conf.api_key["Authorization"] = token conf.api_key_prefix["Authorization"] = "Bearer" - api = fatcat_client.DefaultApi(fatcat_client.ApiClient(conf)) + api = fatcat_openapi_client.DefaultApi(fatcat_openapi_client.ApiClient(conf)) # verify up front that auth is working api.auth_check() diff --git a/python/fatcat_tools/importers/arabesque.py b/python/fatcat_tools/importers/arabesque.py index e9376d96..65597d5c 100644 --- a/python/fatcat_tools/importers/arabesque.py +++ b/python/fatcat_tools/importers/arabesque.py @@ -4,7 +4,7 @@ import json import base64 import sqlite3 import itertools -import fatcat_client +import fatcat_openapi_client from .common import EntityImporter, clean, make_rel_url, SANE_MAX_RELEASES, SANE_MAX_URLS @@ -105,7 +105,7 @@ class ArabesqueMatchImporter(EntityImporter): # lookup extid try: re = self.api.lookup_release(**{self.extid_type: extid}) - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: if err.status == 404: # bail on 404 (release not in DB) self.counts['skip-extid-not-found'] += 1 @@ -128,13 +128,13 @@ class ArabesqueMatchImporter(EntityImporter): row['final_url']) urls = [url, ("webarchive", wayback)] - urls = [fatcat_client.FileUrl(rel=rel, url=url) for (rel, url) in urls] + urls = [fatcat_openapi_client.FileUrl(rel=rel, url=url) for (rel, url) in urls] if len(urls) > SANE_MAX_URLS: self.counts['skip-too-many-url'] += 1 return None - fe = fatcat_client.FileEntity( + fe = fatcat_openapi_client.FileEntity( sha1=b32_hex(row['final_sha1']), mimetype=row['final_mimetype'] or self.default_mimetype, release_ids=[re.ident], @@ -147,7 +147,7 @@ class ArabesqueMatchImporter(EntityImporter): existing = None try: existing = self.api.lookup_file(sha1=fe.sha1) - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: if err.status != 404: raise err @@ -177,7 +177,7 @@ class ArabesqueMatchImporter(EntityImporter): # merge the existing into this one and update existing.urls = list(set([(u.rel, u.url) for u in fe.urls + existing.urls])) - existing.urls = [fatcat_client.FileUrl(rel=rel, url=url) for (rel, url) in existing.urls] + existing.urls = [fatcat_openapi_client.FileUrl(rel=rel, url=url) for (rel, url) in existing.urls] if len(existing.urls) > SANE_MAX_URLS: self.counts['skip-update-too-many-url'] += 1 return None @@ -192,8 +192,8 @@ class ArabesqueMatchImporter(EntityImporter): return False def insert_batch(self, batch): - self.api.create_file_auto_batch(fatcat_client.FileAutoBatch( - editgroup=fatcat_client.Editgroup( + self.api.create_file_auto_batch(fatcat_openapi_client.FileAutoBatch( + editgroup=fatcat_openapi_client.Editgroup( description=self.editgroup_description, extra=self.editgroup_extra), entity_list=batch)) diff --git a/python/fatcat_tools/importers/arxiv.py b/python/fatcat_tools/importers/arxiv.py index 71b2d134..c69ee16a 100644 --- a/python/fatcat_tools/importers/arxiv.py +++ b/python/fatcat_tools/importers/arxiv.py @@ -6,7 +6,7 @@ import datetime from bs4 import BeautifulSoup from pylatexenc.latex2text import LatexNodes2Text -import fatcat_client +import fatcat_openapi_client from .common import EntityImporter, clean from .crossref import lookup_license_slug @@ -120,7 +120,7 @@ class ArxivRawImporter(EntityImporter): doi = None title = latex_to_text(metadata.title.string) authors = parse_arxiv_authors(metadata.authors.string) - contribs = [fatcat_client.ReleaseContrib(index=i, raw_name=a, role='author') for i, a in enumerate(authors)] + contribs = [fatcat_openapi_client.ReleaseContrib(index=i, raw_name=a, role='author') for i, a in enumerate(authors)] lang = "en" # the vast majority in english if metadata.comments and metadata.comments.string: @@ -178,12 +178,12 @@ class ArxivRawImporter(EntityImporter): if '$' in abst or '{' in abst: mime = "application/x-latex" abst_plain = latex_to_text(abst) - abstracts.append(fatcat_client.ReleaseAbstract(content=abst_plain, mimetype="text/plain", lang="en")) + abstracts.append(fatcat_openapi_client.ReleaseAbstract(content=abst_plain, mimetype="text/plain", lang="en")) else: mime = "text/plain" - abstracts.append(fatcat_client.ReleaseAbstract(content=abst, mimetype=mime, lang="en")) + abstracts.append(fatcat_openapi_client.ReleaseAbstract(content=abst, mimetype=mime, lang="en")) if orig: - abstracts.append(fatcat_client.ReleaseAbstract(content=orig, mimetype=mime)) + abstracts.append(fatcat_openapi_client.ReleaseAbstract(content=orig, mimetype=mime)) # indicates that fulltext probably isn't english either if lang == 'en': lang = None @@ -207,7 +207,7 @@ class ArxivRawImporter(EntityImporter): release_date = version.date.string.strip() release_date = datetime.datetime.strptime(release_date, "%a, %d %b %Y %H:%M:%S %Z").date() # TODO: source_type? - versions.append(fatcat_client.ReleaseEntity( + versions.append(fatcat_openapi_client.ReleaseEntity( work_id=None, title=title, #original_title @@ -216,7 +216,7 @@ class ArxivRawImporter(EntityImporter): release_stage='submitted', release_date=release_date.isoformat(), release_year=release_date.year, - ext_ids=fatcat_client.ReleaseExtIds( + ext_ids=fatcat_openapi_client.ReleaseExtIds( arxiv=arxiv_id, ), number=number, @@ -270,7 +270,7 @@ class ArxivRawImporter(EntityImporter): existing_doi = None try: existing = self.api.lookup_release(arxiv=v.ext_ids.arxiv) - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: if err.status != 404: raise err @@ -281,7 +281,7 @@ class ArxivRawImporter(EntityImporter): if v.ext_ids.doi: try: existing_doi = self.api.lookup_release(doi=v.ext_ids.doi) - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: if err.status != 404: raise err if existing_doi: @@ -325,8 +325,8 @@ class ArxivRawImporter(EntityImporter): # there is no batch/bezerk mode for arxiv importer, except for testing if self._test_override: for batch in batch_batch: - self.api.create_release_auto_batch(fatcat_client.ReleaseAutoBatch( - editgroup=fatcat_client.Editgroup( + self.api.create_release_auto_batch(fatcat_openapi_client.ReleaseAutoBatch( + editgroup=fatcat_openapi_client.Editgroup( description=self.editgroup_description, extra=self.editgroup_extra), entity_list=batch)) diff --git a/python/fatcat_tools/importers/cdl_dash_dat.py b/python/fatcat_tools/importers/cdl_dash_dat.py index aa7fab2b..536c013b 100755 --- a/python/fatcat_tools/importers/cdl_dash_dat.py +++ b/python/fatcat_tools/importers/cdl_dash_dat.py @@ -9,8 +9,8 @@ import hashlib import mimetypes import subprocess -import fatcat_client -from fatcat_client import * +import fatcat_openapi_client +from fatcat_openapi_client import * from .common import clean from .crossref import lookup_license_slug @@ -176,7 +176,7 @@ def auto_cdl_dash_dat(api, dat_path, release_id=None, editgroup_id=None): try: r = api.lookup_release(doi=release.ext_ids.doi) release_id = r.ident - except fatcat_client.rest.ApiException: + except fatcat_openapi_client.rest.ApiException: pass if not release_id: edit = api.create_release(eg.editgroup_id, release) diff --git a/python/fatcat_tools/importers/chocula.py b/python/fatcat_tools/importers/chocula.py index d7044ff4..6915ba98 100644 --- a/python/fatcat_tools/importers/chocula.py +++ b/python/fatcat_tools/importers/chocula.py @@ -2,7 +2,7 @@ import sys import json import itertools -import fatcat_client +import fatcat_openapi_client from .common import EntityImporter, clean @@ -66,7 +66,7 @@ class ChoculaImporter(EntityImporter): elif 'journal ' in name.lower(): container_type = 'journal' - ce = fatcat_client.ContainerEntity( + ce = fatcat_openapi_client.ContainerEntity( issnl=row['issnl'], ident=row['ident'], name=name, @@ -82,7 +82,7 @@ class ChoculaImporter(EntityImporter): if ce.ident: try: existing = self.api.get_container(ce.ident) - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: if err.status != 404: raise err self.counts['exists'] += 1 @@ -97,7 +97,7 @@ class ChoculaImporter(EntityImporter): # check if existing by ISSN-L try: existing = self.api.lookup_container(issnl=ce.issnl) - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: if err.status != 404: raise err if existing: @@ -157,8 +157,8 @@ class ChoculaImporter(EntityImporter): raise NotImplementedError def insert_batch(self, batch): - self.api.create_container_auto_batch(fatcat_client.ContainerAutoBatch( - editgroup=fatcat_client.Editgroup( + self.api.create_container_auto_batch(fatcat_openapi_client.ContainerAutoBatch( + editgroup=fatcat_openapi_client.Editgroup( description=self.editgroup_description, extra=self.editgroup_extra), entity_list=batch)) diff --git a/python/fatcat_tools/importers/common.py b/python/fatcat_tools/importers/common.py index 2f677be4..093569e1 100644 --- a/python/fatcat_tools/importers/common.py +++ b/python/fatcat_tools/importers/common.py @@ -13,8 +13,8 @@ import xml.etree.ElementTree as ET import pykafka from bs4 import BeautifulSoup -import fatcat_client -from fatcat_client.rest import ApiException +import fatcat_openapi_client +from fatcat_openapi_client.rest import ApiException DATE_FMT = "%Y-%m-%d" @@ -337,7 +337,7 @@ class EntityImporter: if not self._editgroup_id: eg = self.api.create_editgroup( - fatcat_client.Editgroup( + fatcat_openapi_client.Editgroup( description=self.editgroup_description, extra=self.editgroup_extra)) self._editgroup_id = eg.editgroup_id diff --git a/python/fatcat_tools/importers/crossref.py b/python/fatcat_tools/importers/crossref.py index 4074dfb8..faee6aac 100644 --- a/python/fatcat_tools/importers/crossref.py +++ b/python/fatcat_tools/importers/crossref.py @@ -5,7 +5,7 @@ import sqlite3 import datetime import itertools import subprocess -import fatcat_client +import fatcat_openapi_client from .common import EntityImporter, clean @@ -215,7 +215,7 @@ class CrossrefImporter(EntityImporter): extra = None assert ctype in ("author", "editor", "translator") raw_name = clean(raw_name) - contribs.append(fatcat_client.ReleaseContrib( + contribs.append(fatcat_openapi_client.ReleaseContrib( creator_id=creator_id, index=index, raw_name=raw_name, @@ -244,7 +244,7 @@ class CrossrefImporter(EntityImporter): container_name = None if (container_id is None and self.create_containers and (issnl is not None) and container_name): - ce = fatcat_client.ContainerEntity( + ce = fatcat_openapi_client.ContainerEntity( issnl=issnl, publisher=publisher, container_type=self.map_container_type(release_type), @@ -300,7 +300,7 @@ class CrossrefImporter(EntityImporter): ref_extra[k] = clean(rm[k]) if not ref_extra: ref_extra = None - refs.append(fatcat_client.ReleaseRef( + refs.append(fatcat_openapi_client.ReleaseRef( index=i, # doing lookups would be a second import pass target_release_id=None, @@ -316,7 +316,7 @@ class CrossrefImporter(EntityImporter): abstracts = [] abstract = clean(obj.get('abstract')) if abstract and len(abstract) > 10: - abstracts.append(fatcat_client.ReleaseAbstract( + abstracts.append(fatcat_openapi_client.ReleaseAbstract( mimetype="application/xml+jats", content=abstract)) @@ -420,7 +420,7 @@ class CrossrefImporter(EntityImporter): if not extra: extra = None - re = fatcat_client.ReleaseEntity( + re = fatcat_openapi_client.ReleaseEntity( work_id=None, container_id=container_id, title=title, @@ -431,7 +431,7 @@ class CrossrefImporter(EntityImporter): release_date=release_date, release_year=release_year, publisher=publisher, - ext_ids=fatcat_client.ReleaseExtIds( + ext_ids=fatcat_openapi_client.ReleaseExtIds( doi=obj['DOI'].lower(), pmid=extids['pmid'], pmcid=extids['pmcid'], @@ -459,7 +459,7 @@ class CrossrefImporter(EntityImporter): existing = None try: existing = self.api.lookup_release(doi=re.ext_ids.doi) - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: if err.status != 404: raise err # doesn't exist, need to update @@ -474,8 +474,8 @@ class CrossrefImporter(EntityImporter): return True def insert_batch(self, batch): - self.api.create_release_auto_batch(fatcat_client.ReleaseAutoBatch( - editgroup=fatcat_client.Editgroup( + self.api.create_release_auto_batch(fatcat_openapi_client.ReleaseAutoBatch( + editgroup=fatcat_openapi_client.Editgroup( description=self.editgroup_description, extra=self.editgroup_extra), entity_list=batch)) diff --git a/python/fatcat_tools/importers/grobid_metadata.py b/python/fatcat_tools/importers/grobid_metadata.py index ea627dd6..2077eae4 100644 --- a/python/fatcat_tools/importers/grobid_metadata.py +++ b/python/fatcat_tools/importers/grobid_metadata.py @@ -4,7 +4,7 @@ import sys import json import base64 import datetime -import fatcat_client +import fatcat_openapi_client from .common import EntityImporter, clean, make_rel_url MAX_ABSTRACT_BYTES=4096 @@ -56,7 +56,7 @@ class GrobidMetadataImporter(EntityImporter): existing = None try: existing = self.api.lookup_file(sha1=fe.sha1) - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: if err.status != 404: raise err @@ -82,7 +82,7 @@ class GrobidMetadataImporter(EntityImporter): abstract = obj.get('abstract') if abstract and len(abstract) < MAX_ABSTRACT_BYTES and len(abstract) > 10: - abobj = fatcat_client.ReleaseAbstract( + abobj = fatcat_openapi_client.ReleaseAbstract( mimetype="text/plain", content=clean(obj.get('abstract'))) abstracts = [abobj] @@ -91,7 +91,7 @@ class GrobidMetadataImporter(EntityImporter): contribs = [] for i, a in enumerate(obj.get('authors', [])): - contribs.append(fatcat_client.ReleaseContrib( + contribs.append(fatcat_openapi_client.ReleaseContrib( index=i, raw_name=clean(a['name']), given_name=clean(a.get('given_name')), @@ -116,7 +116,7 @@ class GrobidMetadataImporter(EntityImporter): if not cite_extra: cite_extra = None - refs.append(fatcat_client.ReleaseRef( + refs.append(fatcat_openapi_client.ReleaseRef( key=clean(raw.get('id')), year=year, title=clean(raw['title']), @@ -147,7 +147,7 @@ class GrobidMetadataImporter(EntityImporter): if not title or len(title) < 2: return None - re = fatcat_client.ReleaseEntity( + re = fatcat_openapi_client.ReleaseEntity( title=title, release_type="article-journal", release_date=release_date, @@ -158,7 +158,7 @@ class GrobidMetadataImporter(EntityImporter): volume=clean(obj['journal'].get('volume')), issue=clean(obj['journal'].get('issue')), abstracts=abstracts, - ext_ids=fatcat_client.ReleaseExtIds(), + ext_ids=fatcat_openapi_client.ReleaseExtIds(), extra=extra) return re @@ -166,7 +166,7 @@ class GrobidMetadataImporter(EntityImporter): sha1 = base64.b16encode(base64.b32decode(sha1_key.replace('sha1:', ''))).decode('ascii').lower() - fe = fatcat_client.FileEntity( + fe = fatcat_openapi_client.FileEntity( sha1=sha1, size=int(file_size), mimetype=mimetype, @@ -181,10 +181,10 @@ class GrobidMetadataImporter(EntityImporter): cdx['dt'], original) fe.urls.append( - fatcat_client.FileUrl(url=wayback, rel="webarchive")) + fatcat_openapi_client.FileUrl(url=wayback, rel="webarchive")) original_url = make_rel_url(original, default_link_rel=self.default_link_rel) if original_url is not None: - fe.urls.append(fatcat_client.FileUrl(rel=original_url[0], url=original_url[1])) + fe.urls.append(fatcat_openapi_client.FileUrl(rel=original_url[0], url=original_url[1])) return fe @@ -193,8 +193,8 @@ class GrobidMetadataImporter(EntityImporter): return True def insert_batch(self, batch): - self.api.create_file_auto_batch(fatcat_client.FileAutoBatch( - editgroup=fatcat_client.Editgroup( + self.api.create_file_auto_batch(fatcat_openapi_client.FileAutoBatch( + editgroup=fatcat_openapi_client.Editgroup( description=self.editgroup_description, extra=self.editgroup_extra), entity_list=batch)) diff --git a/python/fatcat_tools/importers/jalc.py b/python/fatcat_tools/importers/jalc.py index c1c13bb7..a0e0086b 100644 --- a/python/fatcat_tools/importers/jalc.py +++ b/python/fatcat_tools/importers/jalc.py @@ -7,7 +7,7 @@ import itertools import subprocess from bs4 import BeautifulSoup -import fatcat_client +import fatcat_openapi_client from .common import EntityImporter, clean, is_cjk, DATE_FMT @@ -48,7 +48,7 @@ def parse_jalc_persons(raw_persons): if lang == 'en' and surname and given_name: # english names order is flipped name = "{} {}".format(given_name, surname) - rc = fatcat_client.ReleaseContrib( + rc = fatcat_openapi_client.ReleaseContrib( raw_name=name, surname=surname, given_name=given_name, @@ -269,7 +269,7 @@ class JalcImporter(EntityImporter): # extra: issnp, issne, original_name, languages, country container_extra['country'] = 'jp' container_extra['languages'] = ['ja'] - ce = fatcat_client.ContainerEntity( + ce = fatcat_openapi_client.ContainerEntity( name=container_name, container_type='journal', publisher=publisher, @@ -303,7 +303,7 @@ class JalcImporter(EntityImporter): if not title: return None - re = fatcat_client.ReleaseEntity( + re = fatcat_openapi_client.ReleaseEntity( work_id=None, title=title, original_title=clean(original_title), @@ -311,7 +311,7 @@ class JalcImporter(EntityImporter): release_stage='published', release_date=release_date, release_year=release_year, - ext_ids=fatcat_client.ReleaseExtIds( + ext_ids=fatcat_openapi_client.ReleaseExtIds( doi=doi, pmid=extids['pmid'], pmcid=extids['pmcid'], @@ -338,7 +338,7 @@ class JalcImporter(EntityImporter): existing = None try: existing = self.api.lookup_release(doi=re.ext_ids.doi) - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: if err.status != 404: raise err # doesn't exist, need to insert @@ -353,8 +353,8 @@ class JalcImporter(EntityImporter): return True def insert_batch(self, batch): - self.api.create_release_auto_batch(fatcat_client.ReleaseAutoBatch( - editgroup=fatcat_client.Editgroup( + self.api.create_release_auto_batch(fatcat_openapi_client.ReleaseAutoBatch( + editgroup=fatcat_openapi_client.Editgroup( description=self.editgroup_description, extra=self.editgroup_extra), entity_list=batch)) diff --git a/python/fatcat_tools/importers/journal_metadata.py b/python/fatcat_tools/importers/journal_metadata.py index d24b4103..d439c80a 100644 --- a/python/fatcat_tools/importers/journal_metadata.py +++ b/python/fatcat_tools/importers/journal_metadata.py @@ -2,7 +2,7 @@ import sys import json import itertools -import fatcat_client +import fatcat_openapi_client from .common import EntityImporter, clean @@ -93,7 +93,7 @@ class JournalMetadataImporter(EntityImporter): if not name: return None - ce = fatcat_client.ContainerEntity( + ce = fatcat_openapi_client.ContainerEntity( issnl=row['issnl'], container_type=None, # TODO name=name, @@ -107,7 +107,7 @@ class JournalMetadataImporter(EntityImporter): existing = None try: existing = self.api.lookup_container(issnl=ce.issnl) - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: if err.status != 404: raise err @@ -133,8 +133,8 @@ class JournalMetadataImporter(EntityImporter): raise NotImplementedError def insert_batch(self, batch): - self.api.create_container_auto_batch(fatcat_client.ContainerAutoBatch( - editgroup=fatcat_client.Editgroup( + self.api.create_container_auto_batch(fatcat_openapi_client.ContainerAutoBatch( + editgroup=fatcat_openapi_client.Editgroup( description=self.editgroup_description, extra=self.editgroup_extra), entity_list=batch)) diff --git a/python/fatcat_tools/importers/jstor.py b/python/fatcat_tools/importers/jstor.py index 5016e813..5ff1ecd9 100644 --- a/python/fatcat_tools/importers/jstor.py +++ b/python/fatcat_tools/importers/jstor.py @@ -5,7 +5,7 @@ import datetime import warnings from bs4 import BeautifulSoup -import fatcat_client +import fatcat_openapi_client from .common import EntityImporter, clean, LANG_MAP_MARC from .crossref import CONTAINER_TYPE_MAP @@ -114,7 +114,7 @@ class JstorImporter(EntityImporter): # create container if it doesn't exist if (container_id is None and self.create_containers and (issnl is not None) and journal_title): - ce = fatcat_client.ContainerEntity( + ce = fatcat_openapi_client.ContainerEntity( issnl=issnl, publisher=publisher, container_type=self.map_container_type(release_type), @@ -158,7 +158,7 @@ class JstorImporter(EntityImporter): role = JSTOR_CONTRIB_MAP.get(c.get('contrib-type', 'author')) if not role and c.get('contrib-type'): sys.stderr.write("NOT IN JSTOR_CONTRIB_MAP: {}\n".format(c['contrib-type'])) - contribs.append(fatcat_client.ReleaseContrib( + contribs.append(fatcat_openapi_client.ReleaseContrib( role=role, raw_name=raw_name, given_name=given, @@ -228,7 +228,7 @@ class JstorImporter(EntityImporter): if not extra: extra = None - re = fatcat_client.ReleaseEntity( + re = fatcat_openapi_client.ReleaseEntity( #work_id title=title, #original_title @@ -236,7 +236,7 @@ class JstorImporter(EntityImporter): release_stage=release_stage, release_date=release_date, release_year=release_year, - ext_ids=fatcat_client.ReleaseExtIds( + ext_ids=fatcat_openapi_client.ReleaseExtIds( doi=doi, jstor=jstor_id, ), @@ -270,7 +270,7 @@ class JstorImporter(EntityImporter): existing = None try: existing = self.api.lookup_release(jstor=re.ext_ids.jstor) - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: if err.status != 404: raise err @@ -282,7 +282,7 @@ class JstorImporter(EntityImporter): doi = "10.2307/{}".format(re.ext_ids.jstor) try: existing = self.api.lookup_release(doi=doi) - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: if err.status != 404: raise err @@ -309,8 +309,8 @@ class JstorImporter(EntityImporter): return True def insert_batch(self, batch): - self.api.create_release_auto_batch(fatcat_client.ReleaseAutoBatch( - editgroup=fatcat_client.Editgroup( + self.api.create_release_auto_batch(fatcat_openapi_client.ReleaseAutoBatch( + editgroup=fatcat_openapi_client.Editgroup( description=self.editgroup_description, extra=self.editgroup_extra), entity_list=batch)) diff --git a/python/fatcat_tools/importers/matched.py b/python/fatcat_tools/importers/matched.py index a94584cd..dbb78ec9 100644 --- a/python/fatcat_tools/importers/matched.py +++ b/python/fatcat_tools/importers/matched.py @@ -3,7 +3,7 @@ import sys import json import sqlite3 import itertools -import fatcat_client +import fatcat_openapi_client from fatcat_tools.normal import * from .common import EntityImporter, clean, make_rel_url, SANE_MAX_RELEASES, SANE_MAX_URLS @@ -61,7 +61,7 @@ class MatchedImporter(EntityImporter): return None try: re = self.api.lookup_release(doi=doi) - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: if err.status != 404: raise err re = None @@ -77,7 +77,7 @@ class MatchedImporter(EntityImporter): if extid: try: re = self.api.lookup_release(**{extid_type: extid}) - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: if err.status != 404: raise err re = None @@ -110,7 +110,7 @@ class MatchedImporter(EntityImporter): url = make_rel_url(original, default_link_rel=self.default_link_rel) if url != None: urls.add(url) - urls = [fatcat_client.FileUrl(rel=rel, url=url) for (rel, url) in urls] + urls = [fatcat_openapi_client.FileUrl(rel=rel, url=url) for (rel, url) in urls] if len(urls) == 0: self.counts['skip-no-urls'] += 1 return None @@ -127,7 +127,7 @@ class MatchedImporter(EntityImporter): if urls[0].url.endswith('.pdf'): mimetype = 'application/pdf' - fe = fatcat_client.FileEntity( + fe = fatcat_openapi_client.FileEntity( md5=obj.get('md5'), sha1=obj['sha1'], sha256=obj.get('sha256'), @@ -143,7 +143,7 @@ class MatchedImporter(EntityImporter): existing = None try: existing = self.api.lookup_file(sha1=fe.sha1) - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: if err.status != 404: raise err @@ -183,7 +183,7 @@ class MatchedImporter(EntityImporter): # merge the existing into this one and update existing.urls = list(set([(u.rel, u.url) for u in fe.urls + existing.urls])) - existing.urls = [fatcat_client.FileUrl(rel=rel, url=url) for (rel, url) in existing.urls] + existing.urls = [fatcat_openapi_client.FileUrl(rel=rel, url=url) for (rel, url) in existing.urls] if len(existing.urls) > SANE_MAX_URLS: self.counts['skip-update-too-many-url'] += 1 @@ -203,8 +203,8 @@ class MatchedImporter(EntityImporter): return False def insert_batch(self, batch): - self.api.create_file_auto_batch(fatcat_client.FileAutoBatch( - editgroup=fatcat_client.Editgroup( + self.api.create_file_auto_batch(fatcat_openapi_client.FileAutoBatch( + editgroup=fatcat_openapi_client.Editgroup( description=self.editgroup_description, extra=self.editgroup_extra), entity_list=batch)) diff --git a/python/fatcat_tools/importers/orcid.py b/python/fatcat_tools/importers/orcid.py index 0bdd5d19..0a2c8610 100644 --- a/python/fatcat_tools/importers/orcid.py +++ b/python/fatcat_tools/importers/orcid.py @@ -2,7 +2,7 @@ import sys import json import itertools -import fatcat_client +import fatcat_openapi_client from .common import EntityImporter, clean def value_or_none(e): @@ -64,7 +64,7 @@ class OrcidImporter(EntityImporter): if not display: # must have *some* name return None - ce = fatcat_client.CreatorEntity( + ce = fatcat_openapi_client.CreatorEntity( orcid=orcid, given_name=clean(given), surname=clean(sur), @@ -76,7 +76,7 @@ class OrcidImporter(EntityImporter): existing = None try: existing = self.api.lookup_creator(orcid=raw_record.orcid) - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: if err.status != 404: raise err @@ -89,8 +89,8 @@ class OrcidImporter(EntityImporter): return True def insert_batch(self, batch): - self.api.create_creator_auto_batch(fatcat_client.CreatorAutoBatch( - editgroup=fatcat_client.Editgroup( + self.api.create_creator_auto_batch(fatcat_openapi_client.CreatorAutoBatch( + editgroup=fatcat_openapi_client.Editgroup( description=self.editgroup_description, extra=self.editgroup_extra), entity_list=batch)) diff --git a/python/fatcat_tools/importers/pubmed.py b/python/fatcat_tools/importers/pubmed.py index 4bfbbc79..80cf986c 100644 --- a/python/fatcat_tools/importers/pubmed.py +++ b/python/fatcat_tools/importers/pubmed.py @@ -7,7 +7,7 @@ import warnings from bs4 import BeautifulSoup from bs4.element import NavigableString -import fatcat_client +import fatcat_openapi_client from .common import EntityImporter, clean, LANG_MAP_MARC # from: https://www.ncbi.nlm.nih.gov/books/NBK3827/table/pubmedhelp.T.publication_types/?report=objectonly @@ -508,7 +508,7 @@ class PubmedImporter(EntityImporter): and container_name): # name, type, publisher, issnl # extra: issnp, issne, original_name, languages, country - ce = fatcat_client.ContainerEntity( + ce = fatcat_openapi_client.ContainerEntity( name=container_name, container_type='journal', #NOTE: publisher not included @@ -532,7 +532,7 @@ class PubmedImporter(EntityImporter): primary_abstract = medline.find("Abstract") if primary_abstract and primary_abstract.AbstractText.get('NlmCategory'): joined = "\n".join([m.get_text() for m in primary_abstract.find_all("AbstractText")]) - abst = fatcat_client.ReleaseAbstract( + abst = fatcat_openapi_client.ReleaseAbstract( content=joined, mimetype="text/plain", lang="en", @@ -541,7 +541,7 @@ class PubmedImporter(EntityImporter): abstracts.append(abst) elif primary_abstract: for abstract in primary_abstract.find_all("AbstractText"): - abst = fatcat_client.ReleaseAbstract( + abst = fatcat_openapi_client.ReleaseAbstract( content=abstract.get_text().strip(), mimetype="text/plain", lang="en", @@ -549,7 +549,7 @@ class PubmedImporter(EntityImporter): if abst.content: abstracts.append(abst) if abstract.find('math'): - abst = fatcat_client.ReleaseAbstract( + abst = fatcat_openapi_client.ReleaseAbstract( # strip the <AbstractText> tags content=str(abstract)[14:-15], mimetype="application/mathml+xml", @@ -562,7 +562,7 @@ class PubmedImporter(EntityImporter): lang = "en" if other.get('Language'): lang = LANG_MAP_MARC.get(other['Language']) - abst = fatcat_client.ReleaseAbstract( + abst = fatcat_openapi_client.ReleaseAbstract( content=other.AbstractText.get_text().strip(), mimetype="text/plain", lang=lang, @@ -617,7 +617,7 @@ class PubmedImporter(EntityImporter): if author.find("EqualContrib"): # TODO: schema for this? contrib_extra['equal'] = True - contribs.append(fatcat_client.ReleaseContrib( + contribs.append(fatcat_openapi_client.ReleaseContrib( raw_name=raw_name, given_name=given_name, surname=surname, @@ -628,7 +628,7 @@ class PubmedImporter(EntityImporter): )) if medline.AuthorList['CompleteYN'] == 'N': - contribs.append(fatcat_client.ReleaseContrib(raw_name="et al.")) + contribs.append(fatcat_openapi_client.ReleaseContrib(raw_name="et al.")) for i, contrib in enumerate(contribs): if contrib.raw_name != "et al.": @@ -659,7 +659,7 @@ class PubmedImporter(EntityImporter): ref_extra['unstructured'] = ref_raw.string if not ref_extra: ref_extra = None - refs.append(fatcat_client.ReleaseRef( + refs.append(fatcat_openapi_client.ReleaseRef( target_release_id=ref_release_id, extra=ref_extra, )) @@ -682,7 +682,7 @@ class PubmedImporter(EntityImporter): if not title: return None - re = fatcat_client.ReleaseEntity( + re = fatcat_openapi_client.ReleaseEntity( work_id=None, title=title, original_title=clean(original_title), @@ -691,7 +691,7 @@ class PubmedImporter(EntityImporter): release_date=release_date, release_year=release_year, withdrawn_status=withdrawn_status, - ext_ids=fatcat_client.ReleaseExtIds( + ext_ids=fatcat_openapi_client.ReleaseExtIds( doi=doi, pmid=pmid, pmcid=pmcid, @@ -717,7 +717,7 @@ class PubmedImporter(EntityImporter): existing = None try: existing = self.api.lookup_release(pmid=re.ext_ids.pmid) - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: if err.status != 404: raise err @@ -725,7 +725,7 @@ class PubmedImporter(EntityImporter): if not existing and re.ext_ids.doi: try: existing = self.api.lookup_release(doi=re.ext_ids.doi) - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: if err.status != 404: raise err if existing and existing.ext_ids.pmid and existing.ext_ids.pmid != re.ext_ids.pmid: @@ -751,7 +751,7 @@ class PubmedImporter(EntityImporter): try: self.api.update_release(self.get_editgroup_id(), existing.ident, existing) self.counts['update'] += 1 - except fatcat_client.rest.ApiException as err: + except fatcat_openapi_client.rest.ApiException as err: # there is a code path where we try to update the same release # twice in a row; if that happens, just skip # NOTE: API behavior might change in the future? @@ -765,8 +765,8 @@ class PubmedImporter(EntityImporter): return True def insert_batch(self, batch): - self.api.create_release_auto_batch(fatcat_client.ReleaseAutoBatch( - editgroup=fatcat_client.Editgroup( + self.api.create_release_auto_batch(fatcat_openapi_client.ReleaseAutoBatch( + editgroup=fatcat_openapi_client.Editgroup( description=self.editgroup_description, extra=self.editgroup_extra), entity_list=batch)) diff --git a/python/fatcat_tools/importers/wayback_static.py b/python/fatcat_tools/importers/wayback_static.py index 2125017a..fa0bd4ef 100755 --- a/python/fatcat_tools/importers/wayback_static.py +++ b/python/fatcat_tools/importers/wayback_static.py @@ -16,7 +16,7 @@ import argparse import subprocess from bs4 import BeautifulSoup -from fatcat_client import * +from fatcat_openapi_client import * CDX_API_BASE = "https://web.archive.org/cdx/search/cdx" GWB_URL_BASE = "https://web.archive.org/web" diff --git a/python/fatcat_tools/reviewers/review_common.py b/python/fatcat_tools/reviewers/review_common.py index bb36d4e3..ecf7da8f 100644 --- a/python/fatcat_tools/reviewers/review_common.py +++ b/python/fatcat_tools/reviewers/review_common.py @@ -5,8 +5,8 @@ import datetime import subprocess from collections import Counter -import fatcat_client -from fatcat_client.rest import ApiException +import fatcat_openapi_client +from fatcat_openapi_client.rest import ApiException """ checks should return: @@ -146,7 +146,7 @@ class ReviewBot: "checks": [check.name for check in self.checks], "result_counts": dict(result_counts), }) - annotation = fatcat_client.EditgroupAnnotation( + annotation = fatcat_openapi_client.EditgroupAnnotation( comment_markdown=comment, editgroup_id=editgroup.editgroup_id, extra=extra, diff --git a/python/fatcat_tools/transforms/csl.py b/python/fatcat_tools/transforms/csl.py index f94fa372..7ab94cac 100644 --- a/python/fatcat_tools/transforms/csl.py +++ b/python/fatcat_tools/transforms/csl.py @@ -8,7 +8,7 @@ from citeproc import formatter from citeproc.source.json import CiteProcJSON from citeproc_styles import get_style_filepath -from fatcat_client import ApiClient +from fatcat_openapi_client import ApiClient def contribs_by_role(contribs, role): diff --git a/python/fatcat_tools/transforms/elasticsearch.py b/python/fatcat_tools/transforms/elasticsearch.py index 303d56a9..3a53db4d 100644 --- a/python/fatcat_tools/transforms/elasticsearch.py +++ b/python/fatcat_tools/transforms/elasticsearch.py @@ -1,7 +1,7 @@ import collections -from fatcat_client import ApiClient +from fatcat_openapi_client import ApiClient def check_kbart(year, archive): diff --git a/python/fatcat_tools/transforms/entities.py b/python/fatcat_tools/transforms/entities.py index b67df12d..8e5de286 100644 --- a/python/fatcat_tools/transforms/entities.py +++ b/python/fatcat_tools/transforms/entities.py @@ -1,7 +1,7 @@ import collections -from fatcat_client import ApiClient +from fatcat_openapi_client import ApiClient def entity_to_dict(entity, api_client=None): """ diff --git a/python/fatcat_tools/workers/elasticsearch.py b/python/fatcat_tools/workers/elasticsearch.py index a91b5098..91224d98 100644 --- a/python/fatcat_tools/workers/elasticsearch.py +++ b/python/fatcat_tools/workers/elasticsearch.py @@ -4,7 +4,7 @@ import time import requests from pykafka.common import OffsetType -from fatcat_client import ReleaseEntity, ContainerEntity, ApiClient +from fatcat_openapi_client import ReleaseEntity, ContainerEntity, ApiClient from fatcat_tools import * from .worker_common import FatcatWorker diff --git a/python/fatcat_tools/workers/worker_common.py b/python/fatcat_tools/workers/worker_common.py index cb4e5dab..9ffbe5fd 100644 --- a/python/fatcat_tools/workers/worker_common.py +++ b/python/fatcat_tools/workers/worker_common.py @@ -8,8 +8,8 @@ from itertools import islice from pykafka import KafkaClient from pykafka.common import OffsetType -import fatcat_client -from fatcat_client.rest import ApiException +import fatcat_openapi_client +from fatcat_openapi_client.rest import ApiException def most_recent_message(topic): diff --git a/python/fatcat_transform.py b/python/fatcat_transform.py index 209edfd7..3f90337e 100755 --- a/python/fatcat_transform.py +++ b/python/fatcat_transform.py @@ -13,9 +13,9 @@ from citeproc import formatter from citeproc.source.json import CiteProcJSON from citeproc_styles import get_style_filepath -import fatcat_client -from fatcat_client.rest import ApiException -from fatcat_client import ReleaseEntity, ContainerEntity, ChangelogEntry +import fatcat_openapi_client +from fatcat_openapi_client.rest import ApiException +from fatcat_openapi_client import ReleaseEntity, ContainerEntity, ChangelogEntry from fatcat_tools import uuid2fcid, entity_from_json, entity_to_dict, \ release_to_elasticsearch, container_to_elasticsearch, \ changelog_to_elasticsearch, public_api, release_to_csl, citeproc_csl diff --git a/python/fatcat_util.py b/python/fatcat_util.py index 433f0d0e..08224dce 100755 --- a/python/fatcat_util.py +++ b/python/fatcat_util.py @@ -11,9 +11,9 @@ import sys import json import argparse -import fatcat_client -from fatcat_client.rest import ApiException -from fatcat_client import ReleaseEntity, ContainerEntity, ChangelogEntry +import fatcat_openapi_client +from fatcat_openapi_client.rest import ApiException +from fatcat_openapi_client import ReleaseEntity, ContainerEntity, ChangelogEntry from fatcat_tools import uuid2fcid, fcid2uuid, entity_from_json, \ entity_to_dict, public_api, authenticated_api diff --git a/python/fatcat_web/__init__.py b/python/fatcat_web/__init__.py index ba789609..50757858 100644 --- a/python/fatcat_web/__init__.py +++ b/python/fatcat_web/__init__.py @@ -10,7 +10,7 @@ from flask_mwoauth import MWOAuth from authlib.flask.client import OAuth from loginpass import create_flask_blueprint, Gitlab, GitHub, ORCiD from raven.contrib.flask import Sentry -import fatcat_client +import fatcat_openapi_client from fatcat_web.web_config import Config @@ -39,20 +39,20 @@ oauth = OAuth(app) # Grabs sentry config from SENTRY_DSN environment variable sentry = Sentry(app) -conf = fatcat_client.Configuration() +conf = fatcat_openapi_client.Configuration() conf.host = Config.FATCAT_API_HOST -api = fatcat_client.DefaultApi(fatcat_client.ApiClient(conf)) +api = fatcat_openapi_client.DefaultApi(fatcat_openapi_client.ApiClient(conf)) # remove most jinja2 template whitespace app.jinja_env.trim_blocks = True app.jinja_env.lstrip_blocks = True def auth_api(token): - conf = fatcat_client.Configuration() + conf = fatcat_openapi_client.Configuration() conf.api_key["Authorization"] = token conf.api_key_prefix["Authorization"] = "Bearer" conf.host = Config.FATCAT_API_HOST - return fatcat_client.DefaultApi(fatcat_client.ApiClient(conf)) + return fatcat_openapi_client.DefaultApi(fatcat_openapi_client.ApiClient(conf)) if Config.FATCAT_API_AUTH_TOKEN: print("Found and using privileged token (eg, for account signup)") diff --git a/python/fatcat_web/auth.py b/python/fatcat_web/auth.py index 06c8475b..fc2430f1 100644 --- a/python/fatcat_web/auth.py +++ b/python/fatcat_web/auth.py @@ -6,7 +6,7 @@ from flask import Flask, render_template, send_from_directory, request, \ url_for, abort, g, redirect, jsonify, session, flash from flask_login import logout_user, login_user, UserMixin from fatcat_web import login_manager, app, api, priv_api, Config -import fatcat_client +import fatcat_openapi_client def handle_logout(): logout_user() @@ -62,7 +62,7 @@ def handle_oauth(remote, token, user_info): else: preferred_username = user_info['sub'] - params = fatcat_client.AuthOidc(remote.name, user_info['sub'], iss, preferred_username) + params = fatcat_openapi_client.AuthOidc(remote.name, user_info['sub'], iss, preferred_username) # this call requires admin privs (resp, http_status, http_headers) = priv_api.auth_oidc_with_http_info(params) editor = resp.editor diff --git a/python/fatcat_web/editing_routes.py b/python/fatcat_web/editing_routes.py index 73db76a6..87223868 100644 --- a/python/fatcat_web/editing_routes.py +++ b/python/fatcat_web/editing_routes.py @@ -5,8 +5,8 @@ from flask import Flask, render_template, send_from_directory, request, \ url_for, abort, g, redirect, jsonify, session, flash, Response from flask_login import login_required -from fatcat_client import Editgroup -from fatcat_client.rest import ApiException +from fatcat_openapi_client import Editgroup +from fatcat_openapi_client.rest import ApiException from fatcat_tools.transforms import * from fatcat_web import app, api, auth_api, priv_api from fatcat_web.auth import handle_token_login, handle_logout, load_user, handle_ia_xauth diff --git a/python/fatcat_web/entity_helpers.py b/python/fatcat_web/entity_helpers.py index d6a6eb26..043c67ca 100644 --- a/python/fatcat_web/entity_helpers.py +++ b/python/fatcat_web/entity_helpers.py @@ -1,6 +1,6 @@ from flask import abort -from fatcat_client.rest import ApiException +from fatcat_openapi_client.rest import ApiException from fatcat_tools.transforms import * from fatcat_web import app, api from fatcat_web.search import get_elastic_container_stats, get_elastic_container_random_releases diff --git a/python/fatcat_web/forms.py b/python/fatcat_web/forms.py index 4a1ca3e7..b3073fb9 100644 --- a/python/fatcat_web/forms.py +++ b/python/fatcat_web/forms.py @@ -8,7 +8,7 @@ from flask_wtf import FlaskForm from wtforms import SelectField, DateField, StringField, IntegerField, \ HiddenField, FormField, FieldList, validators -from fatcat_client import ContainerEntity, CreatorEntity, FileEntity, \ +from fatcat_openapi_client import ContainerEntity, CreatorEntity, FileEntity, \ ReleaseEntity, ReleaseContrib, FileUrl, ReleaseExtIds release_type_options = [ diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index d41d6bdf..b626ad1d 100644 --- a/python/fatcat_web/routes.py +++ b/python/fatcat_web/routes.py @@ -6,8 +6,8 @@ from flask import Flask, render_template, make_response, send_from_directory, \ from flask_login import login_required from flask_wtf.csrf import CSRFError -from fatcat_client import Editgroup, EditgroupAnnotation -from fatcat_client.rest import ApiException +from fatcat_openapi_client import Editgroup, EditgroupAnnotation +from fatcat_openapi_client.rest import ApiException from fatcat_tools.transforms import * from fatcat_tools.normal import * from fatcat_web import app, api, auth_api, priv_api, mwoauth diff --git a/python/fatcat_web/web_config.py b/python/fatcat_web/web_config.py index e681b397..ec37b66d 100644 --- a/python/fatcat_web/web_config.py +++ b/python/fatcat_web/web_config.py @@ -72,7 +72,7 @@ class Config(object): GIT_RELEASE = None SENTRY_CONFIG = { - #'include_paths': ['fatcat_web', 'fatcat_client', 'fatcat_tools'], + #'include_paths': ['fatcat_web', 'fatcat_openapi_client', 'fatcat_tools'], 'enable-threads': True, # for uWSGI 'release': GIT_RELEASE, 'tags': { diff --git a/python/shell.py b/python/shell.py index 86cb81a8..436ea7b1 100644 --- a/python/shell.py +++ b/python/shell.py @@ -5,9 +5,9 @@ import datetime import requests import argparse -import fatcat_client -from fatcat_client import * -from fatcat_client.rest import ApiException +import fatcat_openapi_client +from fatcat_openapi_client import * +from fatcat_openapi_client.rest import ApiException from fatcat_tools import * if __name__ == '__main__': @@ -28,23 +28,23 @@ if __name__ == '__main__': admin_id = "aaaaaaaaaaaabkvkaaaaaaaaae" - #fatcat_client.configuration.api_key['Authorization'] = 'YOUR_API_KEY' - #fatcat_client.configuration.api_key_prefix['Authorization'] = 'Bearer' - local_conf = fatcat_client.Configuration() + #fatcat_openapi_client.configuration.api_key['Authorization'] = 'YOUR_API_KEY' + #fatcat_openapi_client.configuration.api_key_prefix['Authorization'] = 'Bearer' + local_conf = fatcat_openapi_client.Configuration() local_conf.api_key["Authorization"] = "AgEPZGV2LmZhdGNhdC53aWtpAhYyMDE5MDEwMS1kZXYtZHVtbXkta2V5AAImZWRpdG9yX2lkID0gYWFhYWFhYWFhYWFhYmt2a2FhYWFhYWFhYWkAAht0aW1lID4gMjAxOS0wMS0wOVQwMDo1Nzo1MloAAAYgnroNha1hSftChtxHGTnLEmM/pY8MeQS/jBSV0UNvXug=" local_conf.api_key_prefix["Authorization"] = "Bearer" local_conf.host = 'http://localhost:9411/v0' local_conf.debug = True - local_api = fatcat_client.DefaultApi(fatcat_client.ApiClient(local_conf)) + local_api = fatcat_openapi_client.DefaultApi(fatcat_openapi_client.ApiClient(local_conf)) - #prod_conf = fatcat_client.Configuration() + #prod_conf = fatcat_openapi_client.Configuration() #prod_conf.api_key["Authorization"] = "AgEPZGV2LmZhdGNhdC53aWtpAg4yMDE4LTEyLTMxLWRldgACJmVkaXRvcl9pZCA9IGFhYWFhYWFhYWFhYWJrdmthYWFhYWFhYWFlAAIeY3JlYXRlZCA9IDIwMTgtMTItMzFUMjE6MTU6NDdaAAAGIMWFZeZ54pH4OzNl5+U5X3p1H1rMioSuIldihuiM5XAw" #prod_conf.api_key_prefix["Authorization"] = "Bearer" #prod_conf.host = 'https://api.fatcat.wiki/v0' - #prod_api = fatcat_client.DefaultApi(fatcat_client.ApiClient(prod_conf)) + #prod_api = fatcat_openapi_client.DefaultApi(fatcat_openapi_client.ApiClient(prod_conf)) - qa_conf = fatcat_client.Configuration() + qa_conf = fatcat_openapi_client.Configuration() qa_conf.api_key["Authorization"] = "AgEPZGV2LmZhdGNhdC53aWtpAg4yMDE4LTEyLTMxLWRldgACJmVkaXRvcl9pZCA9IGFhYWFhYWFhYWFhYWJrdmthYWFhYWFhYWFlAAIeY3JlYXRlZCA9IDIwMTgtMTItMzFUMjE6MTU6NDdaAAAGIMWFZeZ54pH4OzNl5+U5X3p1H1rMioSuIldihuiM5XAw" qa_conf.api_key_prefix["Authorization"] = "Bearer" qa_conf.host = 'https://api.qa.fatcat.wiki/v0' - qa_api = fatcat_client.DefaultApi(fatcat_client.ApiClient(qa_conf)) + qa_api = fatcat_openapi_client.DefaultApi(fatcat_openapi_client.ApiClient(qa_conf)) diff --git a/python/tests/api_annotations.py b/python/tests/api_annotations.py index 0d3c5046..e5566eef 100644 --- a/python/tests/api_annotations.py +++ b/python/tests/api_annotations.py @@ -3,8 +3,8 @@ import json import pytest from copy import copy -from fatcat_client import * -from fatcat_client.rest import ApiException +from fatcat_openapi_client import * +from fatcat_openapi_client.rest import ApiException from fixtures import * diff --git a/python/tests/api_containers.py b/python/tests/api_containers.py index ed2b2675..0850fab7 100644 --- a/python/tests/api_containers.py +++ b/python/tests/api_containers.py @@ -3,8 +3,8 @@ import json import pytest from copy import copy -from fatcat_client import * -from fatcat_client.rest import ApiException +from fatcat_openapi_client import * +from fatcat_openapi_client.rest import ApiException from fixtures import * diff --git a/python/tests/api_creators.py b/python/tests/api_creators.py index 28be6a91..1ce6380a 100644 --- a/python/tests/api_creators.py +++ b/python/tests/api_creators.py @@ -3,8 +3,8 @@ import json import pytest from copy import copy -from fatcat_client import * -from fatcat_client.rest import ApiException +from fatcat_openapi_client import * +from fatcat_openapi_client.rest import ApiException from fixtures import * diff --git a/python/tests/api_editgroups.py b/python/tests/api_editgroups.py index 5346d909..d82c9233 100644 --- a/python/tests/api_editgroups.py +++ b/python/tests/api_editgroups.py @@ -4,8 +4,8 @@ import pytest import datetime from copy import copy -from fatcat_client import * -from fatcat_client.rest import ApiException +from fatcat_openapi_client import * +from fatcat_openapi_client.rest import ApiException from fixtures import * @@ -52,9 +52,9 @@ def test_editgroup_submit(api): assert eg3.submitted assert eg3.changelog_index - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): api.update_editgroup(eg.editgroup_id, eg3, submit=True) - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): eg3.description = "something" api.update_editgroup(eg.editgroup_id, eg3) diff --git a/python/tests/api_editor.py b/python/tests/api_editor.py index 637736e4..64bb2759 100644 --- a/python/tests/api_editor.py +++ b/python/tests/api_editor.py @@ -4,8 +4,8 @@ import pytest import datetime from copy import copy -from fatcat_client import * -from fatcat_client.rest import ApiException +from fatcat_openapi_client import * +from fatcat_openapi_client.rest import ApiException from fixtures import * diff --git a/python/tests/api_entity_editing.py b/python/tests/api_entity_editing.py index 83f38695..d5377e18 100644 --- a/python/tests/api_entity_editing.py +++ b/python/tests/api_entity_editing.py @@ -3,8 +3,8 @@ import json import pytest from copy import copy -from fatcat_client import * -from fatcat_client.rest import ApiException +from fatcat_openapi_client import * +from fatcat_openapi_client.rest import ApiException from fixtures import * @@ -23,7 +23,7 @@ def test_multiple_edits_same_group(api): c3 = CreatorEntity(display_name="right") edit = api.update_creator(eg.editgroup_id, c1.ident, c2) # should fail with existing - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): api.update_creator(eg.editgroup_id, c1.ident, c3) # ... but succeed after deleting api.delete_creator_edit(edit.editgroup_id, edit.edit_id) @@ -54,7 +54,7 @@ def test_edit_after_accept(api): try: api.create_creator(eg.editgroup_id, c2) assert False - except fatcat_client.rest.ApiException as e: + except fatcat_openapi_client.rest.ApiException as e: assert 400 <= e.status < 500 # TODO: need better message #assert "accepted" in e.body @@ -116,7 +116,7 @@ def test_delete_accepted_edit(api): try: api.delete_creator_edit(edit.editgroup_id, edit.edit_id) assert False - except fatcat_client.rest.ApiException as e: + except fatcat_openapi_client.rest.ApiException as e: assert 400 <= e.status < 500 assert "accepted" in e.body diff --git a/python/tests/api_entity_state.py b/python/tests/api_entity_state.py index 9ff99dab..d5ba6301 100644 --- a/python/tests/api_entity_state.py +++ b/python/tests/api_entity_state.py @@ -1,8 +1,8 @@ import pytest -from fatcat_client import * -from fatcat_client.rest import ApiException +from fatcat_openapi_client import * +from fatcat_openapi_client.rest import ApiException from fixtures import * @@ -70,7 +70,7 @@ def test_redirect_entity(api): # get by orcid res = api.lookup_creator(orcid=o1) assert res.ident == c1.ident - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): res = api.lookup_creator(orcid=o2) # update first; check that get on second updates @@ -163,14 +163,14 @@ def test_delete_entity(api): # delete eg = quick_eg(api) api.delete_creator(eg.editgroup_id, c1.ident) - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): # can't re-delete in same editgroup api.delete_creator(eg.editgroup_id, c1.ident) api.accept_editgroup(eg.editgroup_id) res = api.get_creator(c1.ident) assert res.state == "deleted" assert res.display_name is None - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): res = api.lookup_creator(orcid=c1.orcid) # re-delete @@ -180,7 +180,7 @@ def test_delete_entity(api): api.delete_creator(eg.editgroup_id, c1.ident) #api.accept_editgroup(eg.editgroup_id) assert False - except fatcat_client.rest.ApiException as e: + except fatcat_openapi_client.rest.ApiException as e: assert 400 <= e.status < 500 # error is 4xx # undelete @@ -250,11 +250,11 @@ def test_recursive_redirects_entity(api): c2_redirect = CreatorEntity(redirect=c1.ident) eg = quick_eg(api) api.update_creator(eg.editgroup_id, c2.ident, c2_redirect) - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): api.accept_editgroup(eg.editgroup_id) res = api.get_creator(c2.ident) assert res.display_name == "test two" - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): res = api.lookup_creator(orcid=o3) res = api.lookup_creator(orcid=o2) assert res.ident == c2.ident @@ -263,7 +263,7 @@ def test_recursive_redirects_entity(api): c1_redirect = CreatorEntity(redirect=c3.ident) eg = quick_eg(api) api.update_creator(eg.editgroup_id, c1.ident, c1_redirect) - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): api.accept_editgroup(eg.editgroup_id) res = api.get_creator(c1.ident) assert res.display_name == "test one" @@ -291,7 +291,7 @@ def test_recursive_redirects_entity(api): res = api.get_creator(c3.ident) assert res.state == "redirect" assert res.display_name is None - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): res = api.lookup_creator(orcid=o2) # undelete second; check that third updated @@ -329,7 +329,7 @@ def test_recursive_redirects_entity(api): res = api.get_creator(c3.ident) assert res.state == "redirect" assert res.display_name is None - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): res = api.lookup_creator(orcid=o2) eg = quick_eg(api) api.delete_creator(eg.editgroup_id, c3.ident) @@ -358,7 +358,7 @@ def test_self_redirect(api): # redirect first to itself; should error on PUT c1_redirect = CreatorEntity(redirect=c1.ident) eg = quick_eg(api) - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): merge_edit = api.update_creator(eg.editgroup_id, c1.ident, c1_redirect) @@ -382,7 +382,7 @@ def test_wip_redirect(api): try: api.update_creator(eg.editgroup_id, c1.ident, c1_redirect) assert False - except fatcat_client.rest.ApiException as e: + except fatcat_openapi_client.rest.ApiException as e: assert 400 <= e.status < 500 assert "WIP" in e.body @@ -401,7 +401,7 @@ def test_create_redirect(api): try: api.create_creator(eg.editgroup_id, c2) assert False - except fatcat_client.rest.ApiException as e: + except fatcat_openapi_client.rest.ApiException as e: assert 400 <= e.status < 500 assert "redirect" in e.body @@ -415,7 +415,7 @@ def test_create_redirect(api): try: api.create_release(eg.editgroup_id, r2) assert False - except fatcat_client.rest.ApiException as e: + except fatcat_openapi_client.rest.ApiException as e: assert 400 <= e.status < 500 assert "redirect" in e.body @@ -428,7 +428,7 @@ def test_required_entity_fields(api): c1 = CreatorEntity() api.create_creator(eg.editgroup_id, c1) assert False - except fatcat_client.rest.ApiException as e: + except fatcat_openapi_client.rest.ApiException as e: assert 400 <= e.status < 500 assert "display_name" in e.body @@ -437,7 +437,7 @@ def test_required_entity_fields(api): c1 = ContainerEntity() api.create_container(eg.editgroup_id, c1) assert False - except fatcat_client.rest.ApiException as e: + except fatcat_openapi_client.rest.ApiException as e: assert 400 <= e.status < 500 assert "name" in e.body @@ -446,7 +446,7 @@ def test_required_entity_fields(api): c1 = ReleaseEntity(ext_ids=ReleaseExtIds()) api.create_release(eg.editgroup_id, c1) assert False - except fatcat_client.rest.ApiException as e: + except fatcat_openapi_client.rest.ApiException as e: assert 400 <= e.status < 500 assert "title" in e.body @@ -465,6 +465,6 @@ def test_revert_current_status(api): try: api.update_creator(eg.editgroup_id, c1.ident, c1_revert) assert False - except fatcat_client.rest.ApiException as e: + except fatcat_openapi_client.rest.ApiException as e: assert 400 <= e.status < 500 assert "current" in e.body diff --git a/python/tests/api_files.py b/python/tests/api_files.py index dd10058b..74865daa 100644 --- a/python/tests/api_files.py +++ b/python/tests/api_files.py @@ -3,8 +3,8 @@ import json import pytest from copy import copy -from fatcat_client import * -from fatcat_client.rest import ApiException +from fatcat_openapi_client import * +from fatcat_openapi_client.rest import ApiException from fixtures import * diff --git a/python/tests/api_filesets.py b/python/tests/api_filesets.py index 48f58cc8..7f3235cb 100644 --- a/python/tests/api_filesets.py +++ b/python/tests/api_filesets.py @@ -3,8 +3,8 @@ import json import pytest from copy import copy -from fatcat_client import * -from fatcat_client.rest import ApiException +from fatcat_openapi_client import * +from fatcat_openapi_client.rest import ApiException from fixtures import * @@ -98,6 +98,6 @@ def test_bad_fileset(api): ] for b in bad_list: - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): api.create_fileset(eg.editgroup_id, b) diff --git a/python/tests/api_misc.py b/python/tests/api_misc.py index 6fea9d29..11f85fd6 100644 --- a/python/tests/api_misc.py +++ b/python/tests/api_misc.py @@ -3,8 +3,8 @@ import json import pytest from copy import copy -from fatcat_client import * -from fatcat_client.rest import ApiException +from fatcat_openapi_client import * +from fatcat_openapi_client.rest import ApiException from fixtures import * diff --git a/python/tests/api_releases.py b/python/tests/api_releases.py index f2a370c3..2df08698 100644 --- a/python/tests/api_releases.py +++ b/python/tests/api_releases.py @@ -4,8 +4,8 @@ import pytest import datetime from copy import copy -from fatcat_client import * -from fatcat_client.rest import ApiException +from fatcat_openapi_client import * +from fatcat_openapi_client.rest import ApiException from fixtures import * @@ -151,14 +151,14 @@ def test_release_examples(api): # failed lookup exception type try: api.lookup_release(pmid='5432100') - except fatcat_client.rest.ApiException as ae: + except fatcat_openapi_client.rest.ApiException as ae: assert ae.status == 404 assert "DatabaseRowNotFound" in ae.body # failed lookup formatting try: api.lookup_release(doi='blah') - except fatcat_client.rest.ApiException as ae: + except fatcat_openapi_client.rest.ApiException as ae: assert ae.status == 400 assert "MalformedExternalId" in ae.body @@ -182,10 +182,10 @@ def test_empty_fields(api): ext_ids=ReleaseExtIds()) r1edit = api.create_release(eg.editgroup_id, r1) - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): r2 = ReleaseEntity(title="", ext_ids=ReleaseExtIds()) api.create_release(eg.editgroup_id, r2) - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): r2 = ReleaseEntity(title="something", contribs=[ReleaseContrib(raw_name="")], ext_ids=ReleaseExtIds()) api.create_release(eg.editgroup_id, r2) @@ -194,19 +194,19 @@ def test_controlled_vocab(api): eg = quick_eg(api) r1 = ReleaseEntity(title="something", release_type="journal-thingie", ext_ids=ReleaseExtIds()) - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): api.create_release(eg.editgroup_id, r1) r1.release_type = "article" api.create_release(eg.editgroup_id, r1) r2 = ReleaseEntity(title="something else", release_stage="pre-print", ext_ids=ReleaseExtIds()) - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): api.create_release(eg.editgroup_id, r2) r2.release_stage = "published" api.create_release(eg.editgroup_id, r2) r3 = ReleaseEntity(title="something else", withdrawn_status="boondogle", ext_ids=ReleaseExtIds()) - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): api.create_release(eg.editgroup_id, r3) r3.withdrawn_status = "spam" api.create_release(eg.editgroup_id, r3) diff --git a/python/tests/api_webcaptures.py b/python/tests/api_webcaptures.py index 7734398b..1054b41f 100644 --- a/python/tests/api_webcaptures.py +++ b/python/tests/api_webcaptures.py @@ -4,8 +4,8 @@ import pytest import datetime from copy import copy -from fatcat_client import * -from fatcat_client.rest import ApiException +from fatcat_openapi_client import * +from fatcat_openapi_client.rest import ApiException from fixtures import * @@ -155,7 +155,7 @@ def test_bad_webcapture(api): api.create_webcapture(eg.editgroup_id, good) for b in bad_list: - with pytest.raises(fatcat_client.rest.ApiException): + with pytest.raises(fatcat_openapi_client.rest.ApiException): api.create_webcapture(eg.editgroup_id, b) with pytest.raises(ValueError): diff --git a/python/tests/citation_efficiency.py b/python/tests/citation_efficiency.py index b447ca56..aefb7d15 100644 --- a/python/tests/citation_efficiency.py +++ b/python/tests/citation_efficiency.py @@ -3,8 +3,8 @@ import json import pytest from copy import copy -from fatcat_client import * -from fatcat_client.rest import ApiException +from fatcat_openapi_client import * +from fatcat_openapi_client.rest import ApiException from fixtures import * diff --git a/python/tests/fixtures.py b/python/tests/fixtures.py index d958b5dc..78742114 100644 --- a/python/tests/fixtures.py +++ b/python/tests/fixtures.py @@ -6,9 +6,9 @@ import signal import pytest from dotenv import load_dotenv import fatcat_web -import fatcat_client +import fatcat_openapi_client -from fatcat_client import * +from fatcat_openapi_client import * from fatcat_tools import authenticated_api @pytest.fixture @@ -85,6 +85,6 @@ def test_get_changelog_entry(api): ## Helpers ################################################################## def quick_eg(api_inst): - eg = api_inst.create_editgroup(fatcat_client.Editgroup()) + eg = api_inst.create_editgroup(fatcat_openapi_client.Editgroup()) return eg diff --git a/python/tests/subentity_state.py b/python/tests/subentity_state.py index aca0379c..614f88f1 100644 --- a/python/tests/subentity_state.py +++ b/python/tests/subentity_state.py @@ -3,8 +3,8 @@ import json import pytest from copy import copy -from fatcat_client import * -from fatcat_client.rest import ApiException +from fatcat_openapi_client import * +from fatcat_openapi_client.rest import ApiException from fixtures import * """ diff --git a/python/tests/tools_api.py b/python/tests/tools_api.py index f9ccffb3..fd26b8ee 100644 --- a/python/tests/tools_api.py +++ b/python/tests/tools_api.py @@ -1,7 +1,7 @@ import pytest -from fatcat_client import EditgroupAnnotation -from fatcat_client.rest import ApiException +from fatcat_openapi_client import EditgroupAnnotation +from fatcat_openapi_client.rest import ApiException from fatcat_tools import public_api, authenticated_api diff --git a/python/tests/transform_csl.py b/python/tests/transform_csl.py index 9601f19b..6f29cba7 100644 --- a/python/tests/transform_csl.py +++ b/python/tests/transform_csl.py @@ -2,7 +2,7 @@ import json import pytest from fatcat_tools import * -from fatcat_client import * +from fatcat_openapi_client import * from fixtures import api from import_crossref import crossref_importer diff --git a/python/tests/transform_tests.py b/python/tests/transform_tests.py index c36137ba..5e657190 100644 --- a/python/tests/transform_tests.py +++ b/python/tests/transform_tests.py @@ -2,7 +2,7 @@ import json import pytest from fatcat_tools import * -from fatcat_client import * +from fatcat_openapi_client import * from fixtures import api from import_journal_metadata import journal_metadata_importer diff --git a/python/tests/web_auth.py b/python/tests/web_auth.py index b5839c6f..029803c3 100644 --- a/python/tests/web_auth.py +++ b/python/tests/web_auth.py @@ -2,7 +2,7 @@ import json import pytest import responses -from fatcat_client.rest import ApiException +from fatcat_openapi_client.rest import ApiException from fixtures import * diff --git a/python/tests/web_citation_csl.py b/python/tests/web_citation_csl.py index 241f450f..3279ebea 100644 --- a/python/tests/web_citation_csl.py +++ b/python/tests/web_citation_csl.py @@ -2,7 +2,7 @@ import json import tempfile import pytest -from fatcat_client.rest import ApiException +from fatcat_openapi_client.rest import ApiException from fixtures import * diff --git a/python/tests/web_editgroup.py b/python/tests/web_editgroup.py index 2ce90fcb..cbdd2176 100644 --- a/python/tests/web_editgroup.py +++ b/python/tests/web_editgroup.py @@ -1,7 +1,7 @@ import json import pytest -from fatcat_client.rest import ApiException +from fatcat_openapi_client.rest import ApiException from fixtures import * def test_editgroup_basics(app): diff --git a/python/tests/web_editing.py b/python/tests/web_editing.py index d69f18be..1ee20405 100644 --- a/python/tests/web_editing.py +++ b/python/tests/web_editing.py @@ -1,7 +1,7 @@ import json import pytest -from fatcat_client.rest import ApiException +from fatcat_openapi_client.rest import ApiException from fixtures import * diff --git a/python/tests/web_editor.py b/python/tests/web_editor.py index de094488..2614be96 100644 --- a/python/tests/web_editor.py +++ b/python/tests/web_editor.py @@ -1,7 +1,7 @@ import json import pytest -from fatcat_client.rest import ApiException +from fatcat_openapi_client.rest import ApiException from fixtures import * diff --git a/python/tests/web_entity_views.py b/python/tests/web_entity_views.py index 6bbd6848..6555eeeb 100644 --- a/python/tests/web_entity_views.py +++ b/python/tests/web_entity_views.py @@ -1,7 +1,7 @@ import json import pytest -from fatcat_client.rest import ApiException +from fatcat_openapi_client.rest import ApiException from fixtures import * from fatcat_web.forms import ReleaseEntityForm, FileEntityForm, ContainerEntityForm diff --git a/python/tests/web_routes.py b/python/tests/web_routes.py index 3af5369b..026776ee 100644 --- a/python/tests/web_routes.py +++ b/python/tests/web_routes.py @@ -1,7 +1,7 @@ import json import pytest -from fatcat_client.rest import ApiException +from fatcat_openapi_client.rest import ApiException from fixtures import * diff --git a/python/tests/web_search.py b/python/tests/web_search.py index 5828007d..bdd858d0 100644 --- a/python/tests/web_search.py +++ b/python/tests/web_search.py @@ -2,7 +2,7 @@ import json import pytest import responses -from fatcat_client.rest import ApiException +from fatcat_openapi_client.rest import ApiException from fixtures import * @responses.activate |