Comments (3)
Possibly a dumb question on my part How would you handle proxy settings normally lets say if you were just using CURL or requests? That might help me to try to think about a solution! If you can share any examples of workarounds that you have used in the past for this, that would be helpful too!
from ghapi.
@hamelsmu this is a dirty hack, but since I've found it works here you go.
import fastcore.net
from ghapi.all import GhApi
if self.proxies:
# setup proxy for requests
self.session.proxies.update(self.proxies)
# add proxy to fastcore which ghapi uses
proxy = urllib.request.ProxyHandler(self.proxies)
opener = urllib.request.build_opener(proxy)
fastcore.net._opener = opener
self.api = GhApi(token=token)
I'm doing this to monkey patch the opener that fastcore uses on a class that's using GhApi. This does work in an environment behind a proxy, but it really would be much better if the ghapi/fastapi modules provided a way to properly configure this.
from ghapi.
If that snippet isn't clear enough, you can see the whole implementation using requests and ghapi behind a proxy at https://github.com/charmed-kubernetes/github-runner-operator/tree/PAT
Notice that's on a branch that isn't yet merged. If it's merged when you see this the branch will have been deleted just look in the master branch. You're looking for "/src/runner.py" for the use of requests and ghapi.
from ghapi.
Related Issues (20)
- pages does not work for list_packages_for_organization HOT 1
- UnicodeDecodeError on repos.download_tarball_archive HOT 1
- Set outputs is currently using syntax which is due to be deprecated
- feature: get dependabot alerts for enterprise/org
- Self documenting api object does not work as described in docs HOT 1
- Is this project still maintained? HOT 4
- v1.0.4 HOT 3
- Pagination Broke. ghapi 1.0.3 HOT 1
- Document leaky exceptions
- website documentation wrong for secret_scanning & dependabot
- Provide static API documentation HOT 1
- Missing orgs.list_saml_sso_authorizations and other enterprise endpoints HOT 1
- SyntaxWarning: invalid escape sequence HOT 2
- Add ability to read token reported by `gh auth token` HOT 1
- Pagination does not work for api.search.code HOT 2
- Remove `pip` from dependencies HOT 2
- feature request: app authentication support
- How can I get the HTTP response status code after calling the APIs?
- Please add missing tags to the git repository for 1.x releases
- Support for rulesets?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ghapi.