bcicen / devpi-tools Goto Github PK
View Code? Open in Web Editor NEWSmall Python library for interacting with devpi servers via web API
License: MIT License
Small Python library for interacting with devpi servers via web API
License: MIT License
Hi, thanks for providing the devpi-tools. I found an issue working with devpi-tool in a network environment, where a firewall is in charge and cannot be deactivated. In __init__.py
in class DevpiClient in the get_json method in line 24
res = self.request(method, url, headers=headers, verify=verify_ssl).json()
I get a json parsing error, beacuse our firewall is sending back a blockpage in html in self.request(method, url, headers=headers, verify=verify_ssl).text. This error is captured downstrem in the json parser, but it would be nice to cover it in get_json.
This is my modified version:
class DevpiClient(requests.Session):
""" A very small client for connecting to devpi web API """
def __init__(self, base_url, disable_ssl_warning=False):
super(DevpiClient, self).__init__()
self.base_url = base_url
self.disable_ssl_warning = disable_ssl_warning
def get_json(self, path, method='GET', **params):
url = self.base_url + path
headers = {'Accept': 'application/json'}
verify_ssl = True
if self.disable_ssl_warning:
requests.packages.urllib3.disable_warnings()
verify_ssl = False
res_raw = self.request(method, url, headers=headers, verify=verify_ssl)
try:
res = res_raw.json()
except:
raise DevpiApiError(f'Result is not in json format: {res_raw.text}')
if 'message' in res.keys():
raise DevpiApiError(res['message'])
return res['result']
For shure not elegant, but maybe you can implement something like this.
BR,
Johannes
All projects on our devpi server that have versions linking to /root/pypi do not have log meta entry (i.e. no info about when uploaded). The available versions should still return a list, even when additional meta information does not exist.
How can I use this library with a devpi server with authentication?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.